Ubuntu / Linux news and application reviews.

pngcrush

The size to which the PNG image above was compressed may not seem like much, but the original image was already compressed. Besides, if you own a website, compressing ALL the images will most definitely make a difference, especially since - as you can see in the picture above - the quality is basically the same to the naked eye.

The tool I used is called Pngcrush, a free and open source optimizer for PNG (Portable Network Graphics) files. It can be run from a commandline in an MSDOS window, or from a UNIX or LINUX commandline. Its main purpose is to reduce the size of the PNG IDAT datastream by trying various compression levels an PNG filter methods. It also can be used to remove unwanted ancillary chunks, or to add certain chunks including gAMA, tRNS, iCCP, and textual chunks.

If you use Linux, Pngcrush should be in your Linux distribution repositories. For Ubuntu, use the following command to install it:
sudo apt-get install pngcrush


Using Pngcrush


Pngcrush can use 114 different filters for optimizing PNG images. To let Pngcrush choose the best one for your images, you can use the -brute option.

To compress a single image:
pngcrush -brute -e ".compressed.png" image.png

"-e" tells Pngcrush to append the ".compressed.png" name to the initial image name.

To compress all the PNG files in a folder and replace the initial images with the resulted compressed images (that's what the "-d" option does):
pngcrush -brute -d "/my/images" *.png


To see everything that Pngcrush can do, type (in Linux):
pngcrush --help
or:
man pngcrush


Download PNGCrush for Windows and source files. | via: simplehelp