How to Optimize PNG Graphics for Internet
To optimize PNG graphics for its further using in Internet, you should decrease a size of an image and optimize it.
Solutions
- pngrewrite utility
- pngnq utility
- optipng utility
- pngcrush utility
pngrewrite utility
The page of pngrewrite project: http://entropymine.com/jason/pngrewrite/
There is a version for both Windows and Linux.
How to use: pngrewrite infile.png outfile.png
Description: by Jason Summers, available at http://www.pobox.com/~jason1/pngrewrite, is an open-source program that performs lossless image reductions. It works best in conjunction with pngcrush (see below); the user should run pngcrush after pngrewrite.
Утилита pngnq
The page of pngng project: http://pngnq.sourceforge.net/
Utility version fro Windows
Example of optimization command for PNG image with pngnq utility:
pngnq -vf -s1 image.png
optipng utility
The page of pngnq project: http://optipng.sourceforge.net/
There is a special utility version for Windows.
Example of optimization command for PNG image with optipng utility:
optipng -o7 image-nq8.png
Description:
by Cosmin Truţa, available at http://www.cs.toronto.edu/pngtech/optipng, is a newer open-source program, inspired from pngcrush, but designed to be more flexible and to run faster. Unlike pngcrush, OptiPNG performs the trials entirely in memory, and writes only the final output file on the disk. Moreover, it offers multiple optimization presets to the user, who can choose among a range of options from “very few trials” to “very many trials” (in contrast to the coarser “smart vs. brute” option offered by pngcrush).
It is important to mention that the achieved compression ratio is less and less likely to improve when higher-level presets (trigerring more trials) are being used. Even if the program is capable of searching automatically over more than 200 configurations (and the advanced users have access to more than 1000 configurations!), a preset that selects around 10 trials should be satisfactory for most users. Furthermore, a preset that selects between 30-40 trials should be satisfactory for all users, for it is very, very unlikely to be beaten significantly by any wider search. The rest of the trial configurations are offered rather as a curiosity (but they were used in the experimentation from which we concluded they are indeed useless!)
pngcrush utility
The page of the project: http://pmt.sourceforge.net/pngcrush/
Compression command:
pngcrush -rem alla -reduce -brute image.png result.png
Description:
by Glenn Randers-Pehrson, available at http://pmt.sourceforge.net/pngcrush, is an open-source program that iterates over PNG filters and zlib (Deflate) parameters, compresses the image repeatedly using each parameter configuration, and chooses the configuration that yields the smallest compressed (IDAT) output. At the user’s option, the program can explore few (below 10) or many (a brute-force traversal over more than 100) configurations. The method of selecting the parameters for “few” trials is particularly effective, and the use of a brute-force traversal is generally not recommended.
In addition, pngcrush offers a multitude of extra features, such as recovery of erroneous PNG files (e.g. files containing bad CRCs), and chunk-level editing of PNG meta-data.
PS
AdvanceCOMP by Andrea Mazzoleni is a set of tools for optimizing ZIP/GZIP, PNG and MNG files, based on the powerful 7-Zip deflation engine. The name of the PNG optimization tool is AdvPNG. At the time of this writing, AdvPNG does not perform image reductions, so the use of pngrewrite or OptiPNG prior to optimiziation may be necessary. However, given the effectivenes of 7-Zip deflation, AdvanceCOMP is a powerful contender.
The AdvanceCOMP tool set is a part of the AdvanceMAME project, available at http://advancemame.sourceforge.net.