‘optiPNG’ vs ‘PNGcrush’ vs ‘Gimp’ to Reduce PNG Size

Which is better? NEITHER! optipng and pngcrush are dated tools, but they are free, and surprisingly still work. Here are some comparisons on compression levels on a PNG file vs the same file as JPG format.

Page load speed is important as a ranking factor in search engines. It makes sense therefore, to optimize your page for speed. While a CDN is probably the better solution, it doesn’t hurt to ALSO optimize your png files.

I was using cygwin and noticed a few tools related to optimizing png files, and how reducing png size:

  • optipng
  • pngcrush

I’m used to using other tools such as gimp and ifranview to reduce png size before but thought these tools were worth investigating at least.

TLDR

(Not suprisingly) jpg was a better format for web work but I liked optipng better if I had to choose between pngcrush and optipng. Both beat out gimp, unless I used indexed colors, which only work on specific types of images. Gimp > Export > rename as .jpg, save!

Lossy vs Lossless

JPG is “lossy” meaning, it compresses the data in a way where some of the original data is gone and can never be retrieved.
PNG is “lossless” meaning, you can save (nearly) all of the original data.

Transparency

No such thing as a transparent background in jpgs, but PNGs can preserve this layer.

OptiPNG Results

Opti PNG shows me “as-it-happens” as it tries different filters and optimization methods. I liked this. I also like the display of

PNGcrush results

PNG crush doesn’t give me as much info but it does tell me CPU time, which is nice.

Smallest PNG Size Results?

It is entirely possible that there are different results based on file size, image type, image complexity etc. I didn’t test thoroughly and just picked an image instead.

Original PNG (301k)

Original File

Indexed PNG (61k)

Indexed

Optimized PNG (267k)

optimized PNG

JPG (71k)

To be fair though, jpg is lossy, and others are not (with the obvious exception of indexed).
jpg

Batch Processing

This wouldn’t even be worth talking about without a way to automate it right? Who wants to manually process 3,142 png files?

For Loop in Shell

Process all png files using optipng and keep backups. The for loop in the shell uses the f variable to replace the file names on each loop:

After the loop does it’s thing, you have results of the original copied to a .bak file and the new file available for you:

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.