How do I use OptiPNG on Windows to get a lossless file?

2

I simply what to use OptiPNG on Windows to create lossless versions of a folder full of PNGs file.
Is the following command sufficient?

optipng *.png

I've seen things about using the o7 option as well, but in the end, I can't tell how to execute the command to guarantee lossless copies of all the PNG files.

Thank you.

HartleySan

Posted 2015-08-13T02:23:16.710

Reputation: 125

IDK the answer to this question but it is pointless to convert lossy format into a lossless format. You won't gain information back which was already lost. This will only serve to cause the files to grow in size with no real benefit (aside from a small render speed increase). BTW, this is why it's always important to keep your original source images. – krowe – 2015-08-13T05:33:48.533

PNG is already lossless. It is unclear what you want. – ilkhd – 2015-08-13T06:38:04.957

Answers

2

The OptiPNG program shall attempt to optimize PNG files, i.e. reduce their size to a minimum, without losing semantic information. In addition, this program shall perform a suite of auxiliary functions like integrity checks, metadata recovery and pixmap-to-PNG conversion.

The optimization attempts are not guaranteed to succeed. Valid PNG files that cannot be optimized by this program are normally left intact; their size will not grow. The user may request to override this default behavior.

The OptiPNG optimization algorithm step 2:
Run a suite of compression methods and strategies and select the compression parameters that yield the smallest output file. Step 2 may be customized via the −o option.

optipng file.png #default speed
optipng -o5 file.png #slow
optipng -o7 file.png #very slow

I tried the CLI. After some tests I found that the optipng.exe *.png (default speed) and optipng.exe -o7 *.png gave the same results. That depends on the source files of course and my tests were not thorough. For website images optimization I always use the -o7 but for other purposes (e.g. fast bulk operation of 1000 files) a default speed may be wiser, your choice, make some tests.

In the GUI space I use the PNGGauntlet

References:
A Guide to PNG optimization
OptiPNG General Commands Manual

Gregory.K

Posted 2015-08-13T02:23:16.710

Reputation: 56