PNG-files optimiztion - pngout


Optimization of image files to reduce their size without loss of quality is especially important when developing applications for mobile devices, Web applications or Intertet-sites. To reduce the size of png-files there is a good free command-line utility - PNGOUT. This utility is repacked the data in IDAT-chunk (data chunk that contains information about all image pixels), can automatically reduce the color depth (where it makes sense) and remove from package some chunks that are not necessary.

The DEFLATE packer from PNGOUT works slowly but packs the data on 5-10% better. So usually after processing files by PNGOUT their size is reduced by 5-10%, however in some cases compression can reach 90%. PNGOUT is command line utility and can process only one file for one launch. There are also one GUI utility - PNGOUTWin, which is able to process files in batch mode but it isn't free. In addition there is another free wrapper for PNGOUT.

I think that command line tools and batch files are more convenient for automated build (or content optimization) systems. I have wrote a small python-script to batch process all files in some specified directory (I have tested it in Linux and Windows).


For Linux: <source directory> [<output directory>]

For Windows:

python <source directory> [<output directory>]

Where the argument source directory is mandatory and defines path to processed directory, all files in this directory will be optimized. The second argument output directory is optional and defines output path for optimized files.

For example, the command some_dir

performs optimization for all png-files in the directory some_dir and its subdirectories and overwrites them.

and the command some_dir out_dir

performs optimization for all png-files in the directory some_dir and its subdirectories and store them to out_dir directory.

The script can be downloaded from the link below. The PNGOUT utility can be downloaded here for Windows and here for Linux The Python environment can be downloaded here.



No votes yet