Optimise your PNGs to reduce your app size

Monkey Archive Forums/Monkey Discussion/Optimise your PNGs to reduce your app size

matt(Posted 2011) [#1]
Here's a utility I put together some time ago. MacOS X only sorry, but there are similar tools for other platforms.

It will optimise one or more PNG files to reduce their size whilst keeping all the quality. It can do this as internally PNG offers a number of compression methods and related options. The tool just brute force checks all of them, recompressing the PNG over and over, and picks the one with the smallest filesize.

I was able to reduce an image heavy (1000+) iOS app from 4MB to just 800KB.

http://www.gingerbeardman.com/pngenie/

Note: PNGs over a few hundred KB in size may take a while to optimise, so be patient.


xlsior(Posted 2011) [#2]
Very interesting idea -- does anyone know if there's something similar available that runs under Windows?


matt(Posted 2011) [#3]
Internally my tool uses several open source components, all of which are available for Windows. There may be GUIs or wrappers for them, have a look around. Anyway, they are:

optipng
http://optipng.sourceforge.net

advpng
http://advancemame.sourceforge.net/comp-readme.html

pngout
http://www.advsys.net/ken/utils.htm

Each gives variable results, so I run each PNG through all of them.

There are others - such as pngcrush - but they do not improve on the results from these three.


Tri|Ga|De(Posted 2011) [#4]
Thanks!

Nice to a be Mac user.


Jesse(Posted 2011) [#5]
Nice to me. Thank you very much.


Canardian(Posted 2011) [#6]
Very cool, and useful!
I got instantly the idea to make a wrapper which calls all the 3 Windows tools, but it can be probably done with a simple cmd file :)


Xaron(Posted 2011) [#7]
Cool! But I guess you must be aware of such effects: http://monkeycoder.co.nz/Community/posts.php?topic=257


matt(Posted 2011) [#8]
Yes, good point!

The loader used by GLFW can only handle 8 bit formats - PAL8, RGB24 and RGB32 - whereas png has some extra 4 bit formats.


Some PNGs will not work in GLFW target with monkey. In this case resave them manually using a paint program that is known to save PNGs that work with Monkey.


OvineByDesign(Posted 2011) [#9]
For windows users Ive always used http://psydk.org/PngOptimizer.php - still use it for BMAX projects as Photoshop sometimes leaves nasty edges and it does a good job at reducing the file size.


taumel(Posted 2011) [#10]
Thanks but sadly no improvements on the pictures i've used it on.


matt(Posted 2011) [#11]
Can you send me these pictures? Thanks


taumel(Posted 2011) [#12]
No because i only made two random testrenderings without saving any project files and deleted the pictures afterwards. I just made a further test with a screenshot of my desktop reduced to 960x600 and this time the filesize went slightly down from 676kb to 647kb, i guess this one isn't of interest to you?


matt(Posted 2011) [#13]
No, but thanks.

If you ever come across an image that can't be compressed then I'd like to know which program you created it with. Thanks!


taumel(Posted 2011) [#14]
I rendered the pictures with Modo. I remember that Macromedia's Fireworks built the smallest filesizes of all programs i knew, always a few kb less than the competition.


matt(Posted 2011) [#15]
I recently updated this utility, some may find it useful. :)


Perturbatio(Posted 2011) [#16]
http://smush.it <- good for optimizing websites, might be useful for game graphics as well


matt(Posted 2011) [#17]
The FAQs state that service uses the same command line tools as my app.

http://developer.yahoo.com/yslow/smushit/faq.html