[TIP] Optimizing PNG Graphics

netdzynrnetdzynr Member Posts: 296
edited November -1 in Working with GS (Mac)
For those of you building graphics heavy games (which is probably many of you), you might want to consider optimizing your PNG graphics. PNG is a great graphics format, but PNGs can contain a bunch of extra "junk" (profiles, gamma info, etc) that can be stripped out without any noticeable loss of quality (Photoshop PNGs are notorious for this). There are several tools out there for optimizing PNGs, but I just came across ImageOptim, an open source Mac app that apparently uses multiple routines to apply the best optimizing to graphics it can. As a test, I ran it on the 340 images of my current iPad game -- it took a bit over 10 minutes to run, but it was able to shave off 1MB from 5MB worth of PNGs. Pretty nice savings.

<http://imageoptim.pornel.net/>;

When you open up your gameproj file (Finder -> right click [or control click] -> Show Package Contents) you can access the images folder where all your game's PNGs reside. Copy out the folder, process it through ImageOptim, and after a few minutes you should see some filesize savings (note: not all PNGs will be compressed, some may already be as small as they can get). Replace the images folder and you should be good to go.

Remember, always run these kinds of tools on COPIES of your images, and always make backups of your game files, just to be safe.

Comments

  • AfterBurnettAfterBurnett Member Posts: 3,474
    Nice tip! I'll check it out ;)
  • JackBQuickJackBQuick Member Posts: 524
    I've been using PunyPNG but I'll give ImageOptim a try!
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    Yeah I found ImageOptim a couple weeks ago...very nice and yeah...dumb that CS4 doesn't optimize png's at all.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    That app is awesome! It's amazing how much it can save...
  • JuggerJugger Member, PRO Posts: 238
    Thx. I'll try it.
  • quantumsheepquantumsheep Member Posts: 8,188
    Cheers!

    Just being able to drag and drop the files is a big time saver!

    Much appreciated!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • StusAppsStusApps Member, PRO Posts: 1,352
    These utilities are good for bring down the overall size of your app. But do remember it won't impact at all on the amount of ram your images are using when running on the device, that is entirely based on resolution.
  • JackBQuickJackBQuick Member Posts: 524
    I finally got around to trying ImageOptim and I love it! Thanks, netdzynr! Great tip!
  • TymeMasterTymeMaster Member Posts: 527
    Not sure if this tip is valid. Xcode optimizes the PNG files within your application's bundle by default. So any pre-processing you do is a waste of time.

    Since GameSalad games are built with XCode, Read this

    http://developer.apple.com/iphone/library/qa/qa2010/qa1681.html
  • TouchTiltGamesTouchTiltGames Member Posts: 1,162
    so no point in using ImageOptim?
  • netdzynrnetdzynr Member Posts: 296
    GameSalad files might be *packaged* using Xcode, but they are not *built* in Xcode. Look inside your published game bundles. The entire gameproj files are still there, including the XML and PNG files.
  • TymeMasterTymeMaster Member Posts: 527
    Sure they are compiled with XCode, your project file is merely loaded by their code. The compression (pngcrush) can be disabled, but that would be something you would have to verify with Gendai, they can disable compression in the project they use. If they aren't compressed in the bundle then they have it disabled.
  • netdzynrnetdzynr Member Posts: 296
    Sorry but I think you're mistaken. There is no compiling of the gameproj files going on. If there were, you wouldn't be getting them back from the GameSalad servers in the same format they were sent. There would be no XML files and the images would be optimized in such that they weren't openable, according to article you just posted. So it seems to me optimizing images is worthwhile as it reduces filesize and contributes to the reducing the overall footprint of your app.
  • TymeMasterTymeMaster Member Posts: 527
    I am not mistaken, XCode is used to build the app (that Gendai wrote, not the GS crap), and to build the bundle. And by default, PNG's are converted with PNGCRUSH, unless it is disabled in the XCode project. I do not know if Gendai disabled it, so that is why I said "Not sure if this tip is valid." as opposed to "This tip don't work".

    I've been using XCode for a very long time, I think I know what I am talking about. In addition, I never said the gameproj is compiled with XCode, please learn to read before you make comments. This is the second time you are claiming I said things that I did not.

    How do you think gameproj files are executed? Magic? No, its executed by an app that is built in XCode, and that app (along with your files) are then packaged.
  • netdzynrnetdzynr Member Posts: 296
    My apologies if you think I have misinterpreted your comments. The fact remains that a game packaged by Gendai's servers doesn't appear to do anything to the images included within a gameproj file, so for the moment, the optimization of images before sending a game to be packaged seems valid.
  • TymeMasterTymeMaster Member Posts: 527
    Then most likely Gendai set the option so that it doesn't, which is good for now. By the way, it would be nice if Game Salad supported PVRT.
  • AfterBurnettAfterBurnett Member Posts: 3,474
    All I know is that my game project shed several megabytes after using this app.
  • netdzynrnetdzynr Member Posts: 296
    Here's an interesting find you can hold against me TymeMaster...

    When looking closer at a packaged gameproj file here that contains 500+ PNGs, it seems that some of the assets *do* appear to be optimized as mentioned in the article you cite above. And yet many are still not.

    It's weird -- I can't see any rhyme or reason in the division. At first I thought maybe there was some size threshold affecting which images were processed, but both small and large images show up here as "unoptimized" (openable in Preview/PS and the like). Not sure why -- maybe it's just the nature of beta software...

    I wonder if other folks are getting similar results in their builds?
  • TymeMasterTymeMaster Member Posts: 527
    @POLYGAMe

    That's cool, go look up PVR compression and see what compression is about, that is the real savings we don't have access to with Game Salad. It is not good for all images though, but static backgrounds can certainly benefit.

    Oh, and PVR images take less ram in addition to a smaller bundle size. A few megs is not great, 50% or more is great :)
  • TymeMasterTymeMaster Member Posts: 527
    netdzynr said:
    Here's an interesting find you can hold against me TymeMaster...

    When looking closer at a packaged gameproj file here that contains 500+ PNGs, it seems that some of the assets *do* appear to be optimized as mentioned in the article you cite above. And yet many are still not.

    It's weird -- I can't see any rhyme or reason in the division. At first I thought maybe there was some size threshold affecting which images were processed, but both small and large images show up here as "unoptimized" (openable in Preview/PS and the like). Not sure why -- maybe it's just the nature of beta software...

    I wonder if other folks are getting similar results in their builds?

    I do not hold things against you :)

    To be honest we can only find out from Gendai because it matters on how they setup the project file (not talking about the game salad project).

    The fact that it did not do them all is strange!
  • expired_012expired_012 Member Posts: 1,802
    Reduced my file size by 0.6 MB. Not that much but at least its something. The quality of your images dont change tho right?
  • synthesissynthesis Member Posts: 1,693
    I think these image crushers simple optimize the bit data inside the image file...without modifying the actual color data...it has to do with the way pngs are built in the binary of the image. Only reducing the bit depth will affect the quality of the image (ie...going from 24 bit to 8 bit).
  • firemaplegamesfiremaplegames Member Posts: 3,211
    PNG files can store a lot of metadata that has nothing to do with the pixels themselves. These
    image crushers strip all that stuff out.

    They might optimize them further by limiting the color palettes, but I am not sure.
  • jessicaleahyjessicaleahy Member Posts: 144
    That applications is great! It's so shocking just how much it can save.
  • SnippySnippy Member Posts: 19
    thanks for the tip, saved me lots of MB's :)
  • ORBZORBZ Member Posts: 1,304
    In an ideal world GS would do this automatically for us. Maybe v1.0.
  • TymeMasterTymeMaster Member Posts: 527
    netdzynr said:
    Here's an interesting find you can hold against me TymeMaster...

    When looking closer at a packaged gameproj file here that contains 500+ PNGs, it seems that some of the assets *do* appear to be optimized as mentioned in the article you cite above. And yet many are still not.

    It's weird -- I can't see any rhyme or reason in the division. At first I thought maybe there was some size threshold affecting which images were processed, but both small and large images show up here as "unoptimized" (openable in Preview/PS and the like). Not sure why -- maybe it's just the nature of beta software...

    I wonder if other folks are getting similar results in their builds?

    Did you ever find out the reason why?
Sign In or Register to comment.