Home > PNG Tools Overview

PNG Tools Overview

This is an overview of PNG optimization tools, comparing them with a set of special files that requires reductions, better filtering or compression. Each tool can be better in a category, that's why they are tagged by Type.

Lossless tests (PNG Test Corpus)

The PNG Test Corpus is a set of special files that can be reduced. A tool can be able to reduce the file size without doing the appropriate reduction, that's why results are displayed with settings (ColorType, Filtering, Bitdepth, Compression) and with colors like those:

AdvDef by Andrea Mazzoleni

Version tested: 1.17 — Type: Compressor — Test: Lossless (PNG Test Corpus)

AdvDef is a tool that can compress Deflate stream on various files, including PNG. The 1.17 version can use zlib, 7-zip (Deflate) or Zopfli compression algorithms. AdvDef is not a PNG optimizer; it does not modify any PNG characteristics, it just recompresses the iDAT stream that make it a compressor.

advdef -z -1 myfile.png

advdef 1.17 syntax using zlib compression

advdef -z -3 myfile.png

advdef 1.17 syntax using 7-zip (Deflate) compression

advdef -z -4 -i 5 myfile.png

advdef 1.17 syntax using Zopfli compression

The best usage you can do with AdvDef is to run it after a PNG optimizer that can make some reductions. Then, choose 7-zip (Deflate) if you want to get a good compromise between speed and compression, or Zopfli — that's slower — if you want a smaller result.

advdef 1.17 results
Reductions Total Bytes saved Algorithm Total Time
(2/27) 54 697 Bytes zlib 00:05
(2/27) 79 396 Bytes 7-zip (Deflate) 00:15
(2/27) 84 104 Bytes Zopfli (-i 5) 01:23
advdef 1.17 (zlib) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c0-z -1/c3 /f0 /d8 /n11118947656424 (58%)
02-c4-shouldbe-c0-z -1/c4 /f5 /n11144354116032 (53%)
03-c6-shouldbe-c2-z -1/c6 /f5 /n1260991025115848 (61%)
04-c2-filtered-z -1/c2 /f2 /n115041319185 (13%)
05-c3-shouldbe-c2-z -1/c3 /f0 /d8 /n113611365-4 (0%)
06-c6-shouldbe-c3-z -1/c6 /f5 /n1248071074914058 (57%)
07-c4-shouldbe-c3-z -1/c4 /f5 /n11262863196309 (50%)
08-c0-shouldbe-c3-z -1/c0 /f5 /d8 /n11601216223-211 (-1%)
09-c3-troncate-palette-z -1/c3 /f0 /d8 /n1923648154421 (48%)
10-c3-trns-first-z -1/c3 /f0 /d8 /n1966562363429 (36%)
11-c3-4bits-pixels-z -1/c3 /f0 /d8 /n118424601382 (76%)
12-c3-8bits-pixels-z -1/c3 /f0 /d4 /n1770065071193 (16%)
13-c3-compact-idat-z -1/c3 /f0 /d4 /n1578723913396 (59%)
14-c3-delete-chunks-z -1/c3 /f0 /d4 /n136292657972 (27%)
15-c3-palette-organization-z -1/c3 /f0 /d8 /n117280140973183 (19%)
16-c3-palette-organization-trnslucide-z -1/c3 /f0 /d8 /n127683264771206 (5%)
17-c3-duplicate-entries-z -1/c3 /f0 /d8 /n1887610367-1491 (-16%)
18-c2-souldbe-filtered-c3-z -1/c2 /f0 /n11827320646-2373 (-12%)
19-c6-shouldbe-c4-z -1/c6 /f5 /n11643091737257 (45%)
20-c6-shouldbe-c4-rgbdata-z -1/c6 /f5 /n12326225580-2318 (-9%)
21-c6-rgbdata-z -1/c6 /f5 /n12527528290-3015 (-11%)
22-c6-blackpixels-shouldbe-filtered-z -1/c6 /f5 /n188349706-872 (-9%)
23-c6-rgbdata-shouldbe-c3-z -1/c6 /f5 /n14740250686-3284 (-6%)
24-c4-rgbdata-shouldbe-c3-z -1/c4 /f5 /n12544227553-2111 (-8%)
25-c2-compression-strategy-z -1/c2 /f5 /n12387926799-2920 (-12%)
26-c6-donterase-rgbdata-z -1/c6 /f5 /n1898610104-1118 (-12%)
27-c6-extended-filtering-2-z -1/c6 /f5 /n181028983-881 (-10%)
advdef 1.17 (7-zip (Deflate)) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c0-z -3/c3 /f0 /d8 /n21118944976692 (60%)
02-c4-shouldbe-c0-z -3/c4 /f5 /n31144347756668 (59%)
03-c6-shouldbe-c2-z -3/c6 /f5 /n626099933916760 (65%)
04-c2-filtered-z -3/c2 /f2 /n415041266238 (16%)
05-c3-shouldbe-c2-z -3/c3 /f0 /d8 /n113611365-4 (0%)
06-c6-shouldbe-c3-z -3/c6 /f5 /n624807981314994 (61%)
07-c4-shouldbe-c3-z -3/c4 /f5 /n31262856996929 (55%)
08-c0-shouldbe-c3-z -3/c0 /f5 /d8 /n31601215617395 (3%)
09-c3-troncate-palette-z -3/c3 /f0 /d8 /n2923645274709 (51%)
10-c3-trns-first-z -3/c3 /f0 /d8 /n2966559533712 (39%)
11-c3-4bits-pixels-z -3/c3 /f0 /d8 /n218424731369 (75%)
12-c3-8bits-pixels-z -3/c3 /f0 /d4 /n1770060441656 (22%)
13-c3-compact-idat-z -3/c3 /f0 /d4 /n1578722673520 (61%)
14-c3-delete-chunks-z -3/c3 /f0 /d4 /n1362925331096 (31%)
15-c3-palette-organization-z -3/c3 /f0 /d8 /n217280136903590 (21%)
16-c3-palette-organization-trns-z -3/c3 /f0 /d8 /n327683251542529 (10%)
17-c3-duplicate-entries-z -3/c3 /f0 /d8 /n388769121-245 (-2%)
18-c2-souldbe-filtered-c3-z -3/c2 /f0 /n41827318442-169 (0%)
19-c6-shouldbe-c4-z -3/c6 /f5 /n61643086057825 (48%)
20-c6-shouldbe-c4-rgbdata-z -3/c6 /f5 /n62326223596-334 (-1%)
21-c6-rgbdata-z -3/c6 /f5 /n62527525626-351 (-1%)
22-c6-blackpixels-shouldbe-filtered-z -3/c6 /f5 /n288348961-127 (-1%)
23-c6-rgbdata-shouldbe-c3-z -3/c6 /f5 /n54740247638-236 (0%)
24-c4-rgbdata-shouldbe-c3-z -3/c4 /f5 /n32544225519-77 (0%)
25-c2-compression-strategy-z -3/c2 /f5 /n32387925476-1597 (-6%)
26-c6-donterase-rgbdata-z -3/c6 /f5 /n589868991-5 (0%)
27-c6-extended-filtering-2-z -3/c6 /f5 /n281028243-141 (-1%)
advdef 1.17 (Zopfli) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c0-z -4 -i 5/c3 /f0 /d8 /n21118944836706 (60%)
02-c4-shouldbe-c0-z -4 -i 5/c4 /f5 /n11144347046739 (59%)
03-c6-shouldbe-c2-z -4 -i 5/c6 /f5 /n226099894217157 (66%)
04-c2-filtered-z -4 -i 5/c2 /f2 /n415041147357 (24%)
05-c3-shouldbe-c2-z -4 -i 5/c3 /f0 /d8 /n21361131645 (4%)
06-c6-shouldbe-c3-z -4 -i 5/c6 /f5 /n124807933515472 (63%)
07-c4-shouldbe-c3-z -4 -i 5/c4 /f5 /n11262855477081 (57%)
08-c0-shouldbe-c3-z -4 -i 5/c0 /f5 /d8 /n21601215508504 (4%)
09-c3-troncate-palette-z -4 -i 5/c3 /f0 /d8 /n3923645184718 (52%)
10-c3-trns-first-z -4 -i 5/c3 /f0 /d8 /n4966559233742 (39%)
11-c3-4bits-pixels-z -4 -i 5/c3 /f0 /d8 /n118424561386 (76%)
12-c3-8bits-pixels-z -4 -i 5/c3 /f0 /d4 /n4770059771723 (23%)
13-c3-compact-idat-z -4 -i 5/c3 /f0 /d4 /n2578722373550 (62%)
14-c3-delete-chunks-z -4 -i 5/c3 /f0 /d4 /n2362925031126 (32%)
15-c3-palette-organization-z -4 -i 5/c3 /f0 /d8 /n417280136153665 (22%)
16-c3-palette-organization-trns-z -4 -i 5/c3 /f0 /d8 /n527683250892594 (10%)
17-c3-duplicate-entries-z -4 -i 5/c3 /f0 /d8 /n788768901-25 (0%)
18-c2-souldbe-filtered-c3-z -4 -i 5/c2 /f0 /n21827318343-70 (0%)
19-c6-shouldbe-c4-z -4 -i 5/c6 /f5 /n11643081818249 (51%)
20-c6-shouldbe-c4-rgbdata-z -4 -i 5/c6 /f5 /n823262232539 (1%)
21-c6-rgbdata-z -4 -i 5/c6 /f5 /n7252752525124 (1%)
22-c6-blackpixels-shouldbe-filtered-z -4 -i 5/c6 /f5 /n2883488304 (1%)
23-c6-rgbdata-shouldbe-c3-z -4 -i 5/c6 /f5 /n64740247201201 (1%)
24-c4-rgbdata-shouldbe-c3-z -4 -i 5/c4 /f5 /n42544225468-26 (0%)
25-c2-compression-strategy-z -4 -i 5/c2 /f5 /n62387924761-882 (-3%)
26-c6-donterase-rgbdata-z -4 -i 5/c6 /f5 /n189868849137 (2%)
27-c6-extended-filtering-2-z -4 -i 5/c6 /f5 /n281028184-82 (-1%)

cryopng by Frédéric Kayser

Version tested: 0.6.4 — Type: RGBA Reducer — Test: Lossless (PNG Test Corpus)

Mainly based on OptiPNG, cryopng works only on RGBA PNG, and tries to modify RGB data that are not displayed to users including turning them to 0,0,0. It uses the filtering system on RGB area to modify colors, and can try up to five combinations (-f0, -f1, -f2, -f3, -f4). It's a RGBA Reducer.

cryopng -o7 myfile.png

cryopng 0.6.4 syntax using zlib compression

cryopng is good for RGB modifications with PNG-32 files. It can be completed by a tool to search filtering, and another compressor (7-zip (Deflate), KS-Flate or Zopfli). You can hack the GrayScale support using the following combination:

:: Convert GrayScale+Alpha to TrueColor+Alpha
pngout -c6 -s4 myfile.png
	:: cryopng job
	cryopng -o7 myfile.png
:: Encode to GrayScale+Alpha
pngout -c4 myfile.png

Hack with cryopng and PNGOUT to modify GrayScale+A files

cryopng 0.6.4 results
Reductions Total Bytes saved Algorithm Total Time
(3/9) 95 126 Bytes zlib 00:32
cryopng 0.6.4 (zlib) detailed results
File Tested Options Reduction In Out Saved
03-c6-shouldbe-c2-o7/c6 /f0 /n126099927616823 (65%)
06-c6-shouldbe-c3-o7/c6 /f0 /n124807828616521 (67%)
19-c6-shouldbe-c4-o7/c6 /f0 /n11643084977933 (49%)
20-c6-shouldbe-c4-rgbdata-o7/c6 /f0 /n123262849714765 (64%)
21-c6-rgbdata-o7/c6 /f0 /n1252751048514790 (59%)
22-c6-blackpixels-shouldbe-filtered-o7/c6 /f1 /n188348922-88 (0%)
23-c6-rgbdata-shouldbe-c3-o7/c6 /f0 /n1474022179125611 (55%)
26-c6-donterase-rgbdata-o7/c6 /f4 /n189869395-409 (-4%)
27-c6-extended-filtering-2-o7/c6 /f1 /n181028922-820 (-10%)

OptiPNG by Cosmin Truta

Version tested: HG 2012.10.21 — Type: Reducer — Test: Lossless (PNG Test Corpus)

OptiPNG is based on PNGCrush, and also includes part of PNGRewrite code for palette rewriting. Unlike PNGCrush, all trials are performed in memory, and it does some image reductions automatically. It's a PNG reducer that's used by lot of online optimizers.

optipng -o6 -strip all myfile.png

optipng HG 2012.10.21 syntax using zlib compression

The best usage you can do with OptiPNG is to run it before a compressor like Advdef, which can run 7-zip (Deflate) or Zopfli compression algorithms. However, the tool is actually outperformed by TruePNG by far, so the recommandation is to use TruePNG instead of OptiPNG.

optipng 0.6.4 results
Reductions Total Bytes saved Algorithm Total Time
(11,5/27) 97 570 Bytes zlib 02:39
optipng HG 2012.10.21 (zlib) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c0-o6 -strip all/c0 /f4 /d8 /n11118937847405 (67%)
02-c4-shouldbe-c0-o6 -strip all/c3 /f4 /d8 /n11144345506893 (61%)
03-c6-shouldbe-c2-o6 -strip all/c6 /f0 /n326099884617253 (67%)
04-c2-filtered-o6 -strip all/c2 /f4 /n11504569935 (63%)
05-c3-shouldbe-c2-o6 -strip all/c3 /f1 /d8 /n113611058303 (23%)
06-c6-shouldbe-c3-o6 -strip all/c3 /f0 /d8 /n524807631418493 (75%)
07-c4-shouldbe-c3-o6 -strip all/c3 /f4 /d8 /n21262850687560 (60%)
08-c0-shouldbe-c3-o6 -strip all/c0 /f4 /d8 /n21601215568444 (3%)
09-c3-troncate-palette-o6 -strip all/c3 /f0 /d8 /n3923641345102 (56%)
10-c3-trns-first-o6 -strip all/c3 /f0 /d8 /n4966559233742 (39%)
11-c3-4bits-pixels-o6 -strip all/c3 /f0 /d4 /n118422901552 (85%)
12-c3-8bits-pixels-o6 -strip all/c3 /f0 /d4 /n4770059771723 (23%)
13-c3-compact-idat-o6 -strip all/c3 /f0 /d4 /n2578722373550 (62%)
14-c3-delete-chunks-o6 -strip all/c3 /f0 /d4 /n2362922371392 (39%)
15-c3-palette-organization-o6 -strip all/c3 /f0 /d8 /n417280136153665 (22%)
16-c3-palette-organization-trns-o6 -strip all/c3 /f0 /d8 /n527683250892594 (10%)
17-c3-duplicate-entries-o6 -strip all/c3 /f0 /d8 /n788768901-25 (0%)
18-c2-souldbe-filtered-c3-o6 -strip all/c3 /f5 /d8 /n118273129845289 (29%)
19-c6-shouldbe-c4-o6 -strip all/c4 /f0 /n116430584010590 (65%)
20-c6-shouldbe-c4-rgbdata-o6 -strip all/c6 /f5 /n72326223384-122 (0%)
21-c6-rgbdata-o6 -strip all/c6 /f5 /n72527525595-320 (-1%)
22-c6-blackpixels-shouldbe-filtered-o6 -strip all/c6 /f5 /n288348653181 (3%)
23-c6-rgbdata-shouldbe-c3-o6 -strip all/c6 /f2 /n84740246413989 (3%)
24-c4-rgbdata-shouldbe-c3-o6 -strip all/c4 /f4 /n32544226038-596 (-2%)
25-c2-compression-strategy-o6 -strip all/c2 /f5 /n62387924737-858 (-3%)
26-c6-donterase-rgbdata-o6 -strip all/c6 /f4 /n189868849137 (2%)
27-c6-extended-filtering-2-o6 -strip all/c6 /f5 /n481028403-301 (-3%)

Pngcrush by Glenn Randers-Pehrson

Version tested: 1.7.67 — Type: Manual Reducer — Test: Lossless (PNG Test Corpus)

Pngcrush is one of the first PNG optimizer. It was created by Glenn Randers-Pehrson, who wrote part of PNG specs. Most of tools are inspired by Pngcrush, but to use well, we've to know how PNG works at user level: most of reduction options must be specify manually. It's a PNG reducer.

pngcrush -brute -blacken -reduce myfile.png

pngcrush does some reductions with zlib compression

If you don't know about PNG specifications, just do not use Pngcrush. Once you reduced your file with Pngcrush, you can use 7-zip (Deflate), KS-Flate or Zopfli to compress the file further. However, advice is same as OptiPNG: use TruePNG instead.

pngcrush 1.7.67 results
Reductions Total Bytes saved Algorithm Total Time
(13,5/27) 142 398 Bytes zlib 01:45
pngcrush 1.7.67 (zlib) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c0-c 0 -brute/c0 /f4 /d8 /n11118940797110 (64%)
02-c4-shouldbe-c0-c 0 -brute/c0 /f4 /d8 /n11144345406903 (60%)
03-c6-shouldbe-c2-c 2 -brute/c2 /f0 /n126099864317438 (66%)
04-c2-filtered-brute/c2 /f4 /n11504572932 (62%)
05-c3-shouldbe-c2-c 2 -rem PLTE -brute/c2 /f5 /n11236459777 (63%)
06-c6-shouldbe-c3-c 3 -reduce -brute/c6 /f0 /n124807828616521 (67%)
07-c4-shouldbe-c3-c 3 -reduce -brute/c4 /f0 /n11262859116717 (54%)
08-c0-shouldbe-c3-c 3 -reduce -brute/c0 /f4 /d8 /n11601215771241 (2%)
09-c3-troncate-palette(1.7.15) -plte_len 128/c3 /f0 /d8 /n148154431384 (8%)
10-c3-trns-first-reduce -brute/c3 /f0 /d8 /n1966562363429 (36%)
11-c3-4bits-pixels-bit_depth 4 -brute/c3 /f0 /d4 /n118422931549 (85%)
12-c3-8bits-pixels-bit_depth 8 -brute/c3 /f0 /d8 /n1770063471353 (18%)
13-c3-compact-idat-brute/c3 /f0 /d4 /n1578723863401 (59%)
14-c3-delete-chunks-rem alla -brute/c3 /f0 /d4 /n1362924021227 (34%)
15-c3-palette-organization-brute/c3 /f0 /d8 /n117280140973183 (19%)
16-c3-palette-organization-trns-brute/c3 /f0 /d8 /n127683264771206 (5%)
17-c3-duplicate-entries-reduce -brute/c3 /f0 /d8 /n1887610294-1418 (-15%)
18-c2-souldbe-filtered-c3-c 3 -brute/c2 /f0 /n11827320646-2373 (-12%)
19-c6-shouldbe-c4-c 4 -brute/c4 /f0 /n116430632010110 (62%)
20-c6-shouldbe-c4-rgbdata-c 4 -blacken -brute/c4 /f0 /n123262632016942 (73%)
21-c6-rgbdata-blacken -brute/c6 /f0 /n1252751047814797 (59%)
22-c6-blackpixels-shouldbe-f.-blacken -brute/c6 /f5 /n188349226-392 (-4%)
23-c6-rgbdata-shouldbe-c3-blacken -c 3 -brute/c6 /f0 /n1474022188525517 (54%)
24-c4-rgbdata-shouldbe-c3-blacken -c 3 -brute/c4 /f1 /n125442174018041 (32%)
25-c2-compression-strategy-huffman/c2 /f5 /n22387923668211 (1%)
26-c6-donterase-rgbdata-brute/c6 /f4 /n189869451-465 (-5%)
27-c6-extended-filtering-2-brute/c6 /f5 /n181029045-943 (-11%)

PngOptimizer by Hadrien Nilsson

Version tested: 2.3 — Type: Reducer — Test: Lossless (PNG Test Corpus)

PNGOptimizer is the faster tool tested here — PNG Test Corpus in 3 seconds. It does major reductions, like turning to 0,0,0 colors that are not restitued in browser, and try some conversion between most used ColorType. It uses a multi-threading system to be faster. It's a PNG reducer.

pngoptimizer -file:myfile.png

pngoptimizer using zlib compression

If you look for speed, PngOptimizer is one of the best tool. Since it's now multi-threaded, it's even faster. It uses zlib, so you can compress files further using 7-zip (Deflate) (Advdef), KS-Flate (PNGOUT) or Zopfli (PNGZopfli).

pngoptimizer 2.3 results
Reductions Total Bytes saved Algorithm Total Time
(13,5/27) 149 216 Bytes zlib 00:03
pngoptimizer 2.3 (zlib) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c0-/c0 /f4 /d8 /n11118940797110 (64%)
02-c4-shouldbe-c0-/c0 /f4 /d8 /n11144345416902 (61%)
03-c6-shouldbe-c2-/c2 /f0 /n126099865617443 (67%)
04-c2-filtered-/c2 /f4 /n11504572932 (62%)
05-c3-shouldbe-c2-/c3 /f4 /d8 /n113611060301 (23%)
06-c6-shouldbe-c3-/c6 /f0 /n124807828416523 (67%)
07-c4-shouldbe-c3-/c4 /f0 /n11262859366692 (53%)
08-c0-shouldbe-c3-/c0 /f4 /d8 /n21601215843169 (2%)
09-c3-troncate-palette-/c3 /f0 /d8 /n1923643374899 (54%)
10-c3-trns-first-/c3 /f4 /d8 /n1966557883877 (41%)
11-c3-4bits-pixels-/c3 /f0 /d4 /n118422931549 (85%)
12-c3-8bits-pixels-/c3 /f0 /d4 /n1770065091191 (16%)
13-c3-compact-idat-/c3 /f0 /d4 /n1578723923395 (59%)
14-c3-delete-chunks-/c3 /f0 /d4 /n1362923921237 (35%)
15-c3-palette-organization-/c3 /f4 /d8 /n117280137733507 (21%)
16-c3-palette-organization-trns-/c3 /f4 /d8 /n227683207296954 (26%)
17-c3-duplicate-entries-/c3 /f0 /d4 /n1887621126764 (77%)
18-c2-souldbe-filtered-c3-/c3 /f4 /d8 /n118273137734500 (25%)
19-c6-shouldbe-c4-/c6 /f0 /n11643084977933 (49%)
20-c6-shouldbe-c4-rgbdata-/c6 /f0 /n123262849714765 (64%)
21-c6-rgbdata-/c6 /f0 /n1252751048014795 (59%)
22-c6-blackpixels-shouldbe-filtered-/c6 /f5 /n188349588-754 (-8%)
23-c6-rgbdata-shouldbe-c3-/c6 /f0 /n1474022181225590 (54%)
24-c4-rgbdata-shouldbe-c3-/c4 /f5 /n12544227806-2364 (-8%)
25-c2-compression-strategy-/c2 /f5 /n12387924145-266 (-1%)
26-c6-donterase-rgbdata-/c6 /f5 /n5898611928-2942 (-24%)
27-c6-extended-filtering-2-/c6 /f5 /n381029588-1486 (-15%)

PNGOUT by Ken Silverman

Version tested: 02/20/2013 — Type: Reducer/Compressor — Test: Lossless (PNG Test Corpus)

PNGOUT is a legendary PNG encoder, using one of the most effective Deflate compressor, KS-Flate. It uses its heuristic filtering, does some reductions (pure losslessly), but does not do all known reductions. Considering that, it can be outperformed by another tools.

pngout -f6 -kp -ks myfile.png

PNGOUT used as a compressor, using KS-Flate compression

PNGOUT can be used as pure compressor using -f6 -kp -ks options. It can be good for non-filtered paletted PNG, and most of the time, beat the compression done by zlib or 7-zip (Deflate) — but it's noticeably slower. For best results, you should use a PNG reducer, then use PNGOUT.

PNGOUT 02/20/2013 results
Reductions Total Bytes saved Algorithm Total Time
(17/27) 106 450 Bytes KS-Flate 01:12
PNGOUT 02/20/2013 (KS-Flate) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c0-c0 -n1/c0 /f5 /d8 /n11118937787411 (67%)
02-c4-shouldbe-c0-c0 -n1/c0 /f5 /d8 /n11144340367407 (65%)
03-c6-shouldbe-c2-c2 -n1/c2 /f5 /n126099840117698 (68%)
04-c2-filtered-f4 -n2/c2 /f4 /n21504551953 (64%)
05-c3-shouldbe-c2-c2 -n2/c2 /f5 /n21361445916 (68%)
06-c6-shouldbe-c3-c3 -n1/c3 /f0 /d8 /n124807636618441 (75%)
07-c4-shouldbe-c3-c3 -n1/c3 /f0 /d8 /n11262851217507 (60%)
08-c0-shouldbe-c3-c0 -n2 ¹/c0 /f5 /d8 /n21601215439573 (4%)
09-c3-troncate-palette-c3 -n2/c3 /f0 /d8 /n2923640245212 (57%)
10-c3-trns-first-c3 -n2/c3 /f0 /d8 /n2966555524113 (43%)
11-c3-4bits-pixels-d4 -n1/c3 /f0 /d4 /n118422911551 (85%)
12-c3-8bits-pixels-c3 -d8 -n4/c3 /f0 /d8 /n4770056352065 (27%)
13-c3-compact-idat-c3 -d8 -n3/c3 /f0 /d8 /n3578721063681 (64%)
14-c3-delete-chunks-c3 -d8 -n3 -k0/c3 /f0 /d8 /n3362921061523 (42%)
15-c3-palette-organization-c3 -n1/c3 /f0 /d8 /n117280135953685 (22%)
16-c3-palette-organization-trns-c3 -n4/c3 /f0 /d8 /n427683250252658 (10%)
17-c3-duplicate-entries-c3 -n1/c3 /f0 /d8 /n1887620646812 (77%)
18-c2-souldbe-filtered-c3-c3 -f0 -n1 ¹/c3 /f0 /d8 /n118273135954678 (26%)
19-c6-shouldbe-c4-c4 -n1/c4 /f5 /n116430574410686 (66%)
20-c6-shouldbe-c4-rgbdata-c6 -n6 ¹/c6 /f5 /n6232622320755 (1%)
21-c6-rgbdata-c6 -n5/c6 /f5 /n5252752523738 (1%)
22-c6-blackpixels-shouldbe-filtered-c6 -n2/c6 /f5 /n28834882113 (1%)
23-c6-rgbdata-shouldbe-c3-c6 -n6 ¹/c6 /f5 /n64740247267135 (1%)
24-c4-rgbdata-shouldbe-c3-c4 -n3 ¹/c4 /f5 /n3254422540240 (1%)
25-c2-compression-strategy-s3 -n2/c2 /f5 /n22387923537342 (2%)
26-c6-donterase-rgbdata-c6 -n2/c6 /f5 /n289868841145 (2%)
27-c6-extended-filtering-2-f6 -n1/c6 /f5 /n181028131-29 (0%)

¹ Note: Those options are choosen because PNGOUT can not do reductions, or it's the best option to produce the smaller file.

pngrewrite by Jason Summers

Version tested: 1.4.0 — Type: Paletted Reducer — Test: Lossless (PNG Test Corpus)

Pngrewrite reduces the unnecessarily large palettes into PNG files. It also optimizes transparency data, and reduces the bits-per-pixel or ColorType to GrayScale if possible. The tool only works on Paletted PNG. It's a Paletted Reducer.

pngrewrite myfile.png myfile.png

pngrewrite rewrites palette, using zlib compression

This tool is today obsolete, because all its reductions are know included in lot of tools. PNGOUT use a very similar way to store the palette, and much more with its -n or -b options, that can rewrite slighly the palette (not only does compression tricks).

pngrewrite 1.4.0 results
Reductions Total Bytes saved Algorithm Total Time
(9/15) 70 477 Bytes zlib 00:02
pngrewrite 1.4.0 (zlib) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c0-/c0 /f5 /d8 /n11118942166973 (63%)
02-c4-shouldbe-c0-/c0 /f5 /d8 /n11144346376806 (60%)
06-c6-shouldbe-c3-/c3 /f0 /d8 /n124807676118046 (73%)
07-c4-shouldbe-c3-/c3 /f0 /d8 /n11262855197109 (57%)
08-c0-shouldbe-c3-/c0 /f5 /d8 /n21601215835177 (2%)
09-c3-troncate-palette-/c3 /f0 /d8 /n1923643474889 (53%)
10-c3-trns-first-/c3 /f0 /d8 /n1966558923773 (40%)
11-c3-4bits-pixels-/c3 /f0 /d4 /n118423001542 (84%)
12-c3-8bits-pixels-/c3 /f0 /d4 /n1770065071193 (16%)
13-c3-compact-idat-/c3 /f0 /d4 /n1578723933394 (59%)
14-c3-delete-chunks-/c3 /f0 /d4 /n1362924751154 (32%)
15-c3-palette-organization-/c3 /f0 /d8 /n117280140953185 (19%)
16-c3-palette-organization-trnslucide-/c3 /f0 /d8 /n227683263861297 (5%)
17-c3-duplicate-entries-/c3 /f0 /d4 /n1887621156761 (77%)
18-c2-souldbe-filtered-c3-/c3 /f0 /d8 /n118273140954178 (23%)

pngwolf by Björn Höhrmann

Version tested: Custom — Type: Filtering — Test: Lossless (PNG Test Corpus)

pngwolf does not use any reductions (except turning to 0,0,0 all colors that are not displayed with --normalize-alpha), but is excellent to find the best filtering scanlines. The --max-stagnate-time is second(s) that pngwolf have to test algorithms (if there is improvement, countdown goes back to 0).

pngwolf --zlib-level=9 --zlib-memlevel=9 --max-stagnate-time=5

pngwolf searching the best filtering, zlib compression

Custom build only compresses with zlib, not 7-zip (Deflate). You can find better result with a higher value of --max-stagnate-time option. To compress further, you can use 7-zip (Deflate) (it's used with original build), KS-Flate or Zopfli. The tool is very efficient on RGBA (or GrayScale) files.

pngwolf results
Reductions Total Bytes saved Algorithm Total Time
(3/27) 125 872 Bytes zlib 05:01
pngwolf (zlib) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c0-/c3 /f0 /d8 /n11118947656424 (58%)
02-c4-shouldbe-c0-/c4 /f5 /n11144352776166 (54%)
03-c6-shouldbe-c2-/c6 /f0 /n126099926416835 (65%)
04-c2-filtered-/c2 /f5 /n11504571933 (63%)
05-c3-shouldbe-c2-/c3 /f1 /d8 /n113611058303 (23%)
06-c6-shouldbe-c3-/c6 /f0 /n124807828616521 (67%)
07-c4-shouldbe-c3-/c4 /f0 /n11262859116717 (54%)
08-c0-shouldbe-c3-/c0 /f5 /d8 /n11601216075-63 (0%)
09-c3-troncate-palette-/c3 /f0 /d8 /n1923648154421 (48%)
10-c3-trns-first-/c3 /f0 /d8 /n1966562363429 (36%)
11-c3-4bits-pixels-/c3 /f5 /d8 /n118424581384 (76%)
12-c3-8bits-pixels-/c3 /f0 /d4 /n1770065071193 (16%)
13-c3-compact-idat-/c3 /f5 /d4 /n1578723063481 (61%)
14-c3-delete-chunks-/c3 /f5 /d4 /n1362925721057 (30%)
15-c3-palette-organization-/c3 /f0 /d8 /n117280140973183 (19%)
16-c3-palette-organization-trns-/c3 /f0 /d8 /n127683264771206 (5%)
17-c3-duplicate-entries-/c3 /f0 /d8 /n1887610367-1491 (-16%)
18-c2-souldbe-filtered-c3-/c2 /f0 /n11827320646-2373 (-12%)
19-c6-shouldbe-c4-/c6 /f0 /n11643084967934 (49%)
20-c6-shouldbe-c4-rgbdata-/c6 /f0 /n123262849614766 (64%)
21-c6-rgbdatanormalize-alpha/c6 /f0 /n1252751047814797 (59%)
22-c6-blackpixels-shouldbe-filtered-/c6 /f5 /n188349209-375 (-4%)
23-c6-rgbdata-shouldbe-c3-/c6 /f0 /n1474022188525517 (54%)
24-c4-rgbdata-shouldbe-c3-/c4 /f5 /n12544227329-1887 (-7%)
25-c2-compression-strategy-/c2 /f5 /n12387926672-2793 (-11%)
26-c6-donterase-rgbdata-/c6 /f5 /n189869518-532 (-5%)
27-c6-extended-filtering-2-/c6 /f5 /n181028983-881 (-10%)

PNGZopfli by x128

Version tested: 1.2 — Type: Compressor — Test: Lossless (PNG Test Corpus)

PNGZopfli is very similar to AdvDef: both of them are pure compressor that do not affect PNG characteristics. PNGZopfli gets the iDAT chunk of a PNG file, then compresses it with Zopfli algorithm, and rewrites the file. It does not perform any reductions.

pngzopfli myfile.png 5

PNGZopfli compresses with Zopfli compression

PNGZopfli is an ideal companion for TruePNG (wrote by the same author). TruePNG does reductions and filtering, and PNGZopfli recompresses the Deflate stream with Zopfli. You should not use PNGZopfli alone, always after optimization process.

PNGZopfli results
Reductions Total Bytes saved Algorithm Total Time
(2/27) 84 104 Bytes Zopfli (-i 5) 01:10
PNGZopfli (zlib) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c05/c3 /f0 /d8 /n21118944836706 (60%)
02-c4-shouldbe-c05/c4 /f5 /n11144347046739 (59%)
03-c6-shouldbe-c25/c6 /f5 /n226099894217157 (66%)
04-c2-filtered5/c2 /f2 /n415041147357 (24%)
05-c3-shouldbe-c25/c3 /f0 /d8 /n21361131645 (4%)
06-c6-shouldbe-c35/c6 /f5 /n124807933515472 (63%)
07-c4-shouldbe-c35/c4 /f5 /n11262855477081 (57%)
08-c0-shouldbe-c35/c0 /f5 /d8 /n21601215508504 (4%)
09-c3-troncate-palette5/c3 /f0 /d8 /n3923645184718 (52%)
10-c3-trns-first5/c3 /f0 /d8 /n4966559233742 (39%)
11-c3-4bits-pixels5/c3 /f0 /d8 /n118424561386 (76%)
12-c3-8bits-pixels5/c3 /f0 /d4 /n4770059771723 (23%)
13-c3-compact-idat5/c3 /f0 /d4 /n2578722373550 (62%)
14-c3-delete-chunks5/c3 /f0 /d4 /n2362925031126 (32%)
15-c3-palette-organization5/c3 /f0 /d8 /n417280136153665 (22%)
16-c3-palette-organization-trnslucide5/c3 /f0 /d8 /n527683250892594 (10%)
17-c3-duplicate-entries5/c3 /f0 /d8 /n788768901-25 (0%)
18-c2-souldbe-filtered-c35/c2 /f0 /n21827318343-70 (0%)
19-c6-shouldbe-c45/c6 /f5 /n11643081818249 (51%)
20-c6-shouldbe-c4-rgbdata5/c6 /f5 /n823262232539 (1%)
21-c6-rgbdata5/c6 /f5 /n7252752525124 (1%)
22-c6-blackpixels-shouldbe-filtered5/c6 /f5 /n2883488304 (1%)
23-c6-rgbdata-shouldbe-c35/c6 /f5 /n64740247201201 (1%)
24-c4-rgbdata-shouldbe-c35/c4 /f5 /n42544225468-26 (0%)
25-c2-compression-strategy5/c2 /f5 /n62387924761-882 (-3%)
26-c6-donterase-rgbdata5/c6 /f5 /n189868849137 (2%)
27-c6-extended-filtering-25/c6 /f5 /n281028184-82 (-1%)

TruePNG by x128

Version tested: 0.4.0.9 — Type: Reducer — Test: Lossless (PNG Test Corpus)

TruePNG is the most advanced reducer tested here. It's able to reduce colortype, bitdepth, does palette sorting combinations, not restitued colors modifications, etc. All features are described here: TruePNG tutorial. It can also use quantization to reduce colors (lossy way).

truepng -o1 myfile.png

TruePNG reductions with zlib compression

TruePNG is a very good reducer. It uses zlib compression, so it can be completed with AdvDef, KS-Flate or Zopfli to compress file further. It can be used instead of OptiPNG or PNGCrush, because it operates (more) trials automatically.

TruePNG results
Reductions Total Bytes saved Algorithm Total Time
(26/27) 185 305 Bytes zlib 01:21
TruePNG (zlib) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c0-o4/c0 /f4 /d8 /n11118940887101 (64%)
02-c4-shouldbe-c0-o4/c0 /f5 /d8 /n11144344027041 (62%)
03-c6-shouldbe-c2-o4/c2 /f0 /n126099870817391 (67%)
04-c2-filtered-o4/c2 /f5 /n11504571933 (63%)
05-c3-shouldbe-c2-o4/c2 /f5 /n11361459902 (67%)
06-c6-shouldbe-c3-o4/c3 /f0 /d8 /n724807667618131 (74%)
07-c4-shouldbe-c3-o4/c3 /f5 /d8 /n11262852577371 (59%)
08-c0-shouldbe-c3-o4/c3 /f5 /d8 /n116012146571355 (9%)
09-c3-troncate-palette-o4/c3 /f4 /d8 /n1923643174919 (54%)
10-c3-trns-first-o4/c3 /f4 /d8 /n1966556524013 (42%)
11-c3-4bits-pixels-o4/c3 /f0 /d4 /n118422991543 (84%)
12-c3-8bits-pixels-o4/c3 /f0 /d8 /n4770063231377 (18%)
13-c3-compact-idat-o4/c3 /f5 /d4 /n1578722933494 (61%)
14-c3-delete-chunks-o4/c3 /f5 /d4 /n1362923091320 (37%)
15-c3-palette-organization-o4/c3 /f5 /d8 /n117280133333947 (23%)
16-c3-palette-organization-trnslucide-o4/c3 /f5 /d8 /n227683207376946 (26%)
17-c3-duplicate-entries-o4/c3 /f0 /d4 /n1887621146762 (77%)
18-c2-souldbe-filtered-c3-o4/c3 /f5 /d8 /n118273133334940 (28%)
19-c6-shouldbe-c4-o4/c4 /f0 /n116430629810132 (62%)
20-c6-shouldbe-c4-rgbdata-o4/c4 /f0 /n123262629816964 (73%)
21-c6-rgbdata-o4/c6 /f0 /n1252751039714878 (59%)
22-c6-blackpixels-shouldbe-filtered-o4/c6 /f1 /n188348905-71 (0%)
23-c6-rgbdata-shouldbe-c3-o4/c3 /f5 /d8 /n1474021402633376 (71%)
24-c4-rgbdata-shouldbe-c3-o4/c3 /f5 /d8 /n1254421390711535 (46%)
25-c2-compression-strategy-o4/c2 /f5 /n72387923606273 (2%)
26-c6-donterase-rgbdata-o4/c6 /f5 /n189869451-465 (-5%)
27-c6-extended-filtering-2-o4/c6 /f1 /n181028905-803 (-9%)

ZopfliPNG by Lode Vandevenne, Jyrki Alakuijala

Version tested: 2013-05-07 — Type: Reducer/Compressor — Test: Lossless (PNG Test Corpus)

ZopfliPNG is made by the zopfli team. On most files, ZopfliPNG is good tool that's able to do most of reductions (Colortype, bitdepth, filtering), except for Paletted images — palette sorting, tRNS first, etc. Zopfli produces very similar results as KS-Flate as pure compressor.

zopflipng --iterations=5 myfile.png

ZopfliPNG reductions with Zopfli compression

ZopfliPNG can not be used after a reducer because it does its reductions, filtering and compression combinations. It can not be used as pure compressor for all samples either. However, as any tools tested here, you can run defluff and/or DeflOpt after, to save few bytes.

ZopfliPNG results
Reductions Total Bytes saved Algorithm Total Time
(16,5/27) 165 624 Bytes Zopfli (-i 5) 01:36
ZopfliPNG (Zopfli -i25) detailed results
File Tested Options Reduction In Out Saved
01-c3-shouldbe-c0-/c0 /f4 /d8 /n11118937847405 (67%)
02-c4-shouldbe-c0-/c0 /f5 /d8 /n11144341267317 (64%)
03-c6-shouldbe-c2-/c2 /f0 /n226099825917840 (69%)
04-c2-filtered-/c2 /f5 /n11504570934 (63%)
05-c3-shouldbe-c2-/c2 /f5 /n11361439922 (68%)
06-c6-shouldbe-c3-/c6 /f0 /n124807781516992 (69%)
07-c4-shouldbe-c3-/c3 /f0 /d8 /n31262852367392 (59%)
08-c0-shouldbe-c3-/c0 /f5 /d8 /n11601215487525 (4%)
09-c3-troncate-palette-/c3 /f0 /d8 /n5923640115225 (57%)
10-c3-trns-first-/c3 /f0 /d8 /n4966559273738 (39%)
11-c3-4bits-pixels-/c3 /f0 /d4 /n118422901552 (85%)
12-c3-8bits-pixels-/c3 /f0 /d4 /n5770059791721 (23%)
13-c3-compact-idat-/c3 /f0 /d4 /n2578722373550 (62%)
14-c3-delete-chunks-/c3 /f0 /d4 /n2362922371392 (39%)
15-c3-palette-organization-/c3 /f0 /d8 /n417280136233657 (22%)
16-c3-palette-organization-trns-/c6 /f0 /n42768332518-4835 (-17%)
17-c3-duplicate-entries-/c3 /f0 /d4 /n2887618966980 (79%)
18-c2-souldbe-filtered-c3-/c3 /f0 /d8 /n418273136034670 (26%)
19-c6-shouldbe-c4-/c4 /f5 /n116430566010770 (66%)
20-c6-shouldbe-c4-rgbdata--lossy_transparent/c4 /f5 /n123262566717595 (76%)
21-c6-rgbdata--lossy_transparent/c6 /f0 /n125275987615399 (61%)
22-c6-blackpixels-shouldbe-f.--lossy_transparent/c6 /f1 /n288348842-8 (0%)
23-c6-rgbdata-shouldbe-c3--lossy_transparent/c6 /f0 /n5474022090826494 (56%)
24-c4-rgbdata-shouldbe-c3--lossy_transparent/c4 /f5 /n225442162029240 (37%)
25-c2-compression-strategy-/c2 /f5 /n62387924778-899 (-3%)
26-c6-donterase-rgbdata-/c6 /f4 /n189868848138 (2%)
27-c6-extended-filtering-2--filters=p/c6 /f5 /n281028184-82 (-1%)

DeflOpt by Ben Jos Walbeehm

Version tested: 2.07 — Type: Stream optimizer

DeflOpt is a tool that can be used on differents files, including PNG. It removes garbage from PNG files, cleans huffman symbols and does others tricks to optimize the Deflate structure. Its process is very fast, and can save some extra bytes after most of Deflate compression algorithms.

deflopt -k -b myfile.png

Optimization of Deflate structure by DeflOpt

DeflOpt is not a reducer, it can not do filtering, and it's not a compressor either. You should use it at the end of process, after the final compression. Most of the time, it can reduce PNG file size by few bytes, whatever the compression used (zlib, 7-zip (Deflate), KS-Flate or Zopfli).

defluff by Joachim Henke

Version tested: 0.3.2 — Type: Deflate Stream optimizer

defluff is a very closed project to DeflOpt, and does similar modifications. However, it uses different algorithms. The process is as fast as DeflOpt. You should use defluff after a compression process, you can use it on a file compressed by zlib, 7-zip (Deflate), KS-Flate or Zopfli.

defluff < in.png > out.png

Optimization of Deflate structure by defluff

Because DeflOpt and defluff have not same algorithms implemented, you can combine them to get a smaller output that if they are used alone. To do that, you should try to use this combination (remember, use this after reductions and compression):

deflopt -k -b in.png
defluff < in.png > out.png
deflopt -k -b out.png

Combination of DeflOpt and defluff

Huffmix by Frédéric Kayser

Version tested: 0.6b1 — Type: Mixer

PNGOUT has a random option -r, that can randomized initial tables. It produces files which can have blocks with differents size (in bits). Huffmix check two files created in random mode and gets the smallest blocks to combine them into a new file.

pngout -f6 -r -kp -ks -force in.png test1.png
pngout -f6 -r -kp -ks -force in.png test2.png
huffmix test1.png test2.png "test-1and2-mixed.png"

PNGOUT creates trials, and huffmix mixes them in a new file

Huffmix can be useful if you want to get the smallest file using KS-Flate compression algorithm. Most of the time, it can beat the Zopfli compression algorithm by few bytes, but you should need to run a lot of trials. It makes sense to use combination of DeflOpt and defluff with results.

PNGKT by x128

Version tested: 1.2 — Type: RGBA Reducer — Test: Lossless (PNG Test Corpus)

PNGKT checks alpha channel of a PNG: if a value is 0, then it converts the corresponding RGB value to 0,0,0. These data will be lost, but it's considered lossless once displayed in web browser. This method can reduce the file size significantly.

pngkt myfile.png

PNGKT transforms RGB data to 0,0,0

PNGKT is no longer updated. Actually, TruePNG can do this test and do much more, by transforming RGB components to others values. Use it if you want to see how it works, but use TruePNG (by the same author) to get much better results.

PNGKT results
Reductions Total Bytes saved Algorithm Total Time
(1/10) 69 199 Bytes zlib 00:02
PNGKT (zlib) detailed results
File Tested Options Reduction In Out Saved
03-c6-shouldbe-c2-/c6 /f1 /n1260991374112358 (48%)
06-c6-shouldbe-c3-/c6 /f1 /n1248071332211485 (47%)
19-c6-shouldbe-c4-/c6 /f1 /n116430121424288 (27%)
20-c6-shouldbe-c4-rgbdata-/c6 /f1 /n1232621214211120 (48%)
21-c6-rgbdata-/c6 /f1 /n125275155889687 (39%)
22-c6-blackpixels-shouldbe-filtered-/c6 /f1 /n188349772-938 (-10%)
23-c6-rgbdata-shouldbe-c3-/c6 /f1 /n1474022706020342 (43%)
24-c4-rgbdata-shouldbe-c3-/c4 /f1 /n125442189746468 (26%)
26-c6-donterase-rgbdata-/c6 /f1 /n1898612927-3941 (-43%)
27-c6-extended-filtering-2-/c6 /f1 /n181029772-1670 (-20%)

Lossy Optimization

PNG can be optimized in lossy ways, by modifying the Deflate encoder, or more simply by decreasing the number of colors in RGB space. Most of them can convert TrueColor to Paletted encoding, forcing the quantization to 256 colors maximum.

pngquant by Kornel Lesiński

Version tested: 2.0.1 (September 2013) — Type: Quantizer (Paletted)

pngquant converts a PNG files (typically RGB, RGBA or GrayScale+A) to PNG Paletted by reducing the number of colors up to 256. It keeps transparency effect by affecting alpha values to corresponding RGB entries. It's very efficient for Web, because of file size that can often be reduced by half.

pngquant --speed 1 myfile.png

pngquant converts the file to PNG Paletted using Floyd-Steinberg diffusion

pngquant v2 is highly recommanded for all front-end engineers. It reduces file size significantly, sometimes without any perceptual differences. After pngquant, you can run a reducer or compressor, like TruePNG, AdvDef or PNGOUT.

pngnq-s9 by Adrian Pellas-Rice

Version tested: 2012-11-09 — Type: Quantizer (Paletted)

pngnq-s9 does the same job as pngquant: it converts PNG files to PNG Paletted mode. Unlike pngquant which use a modified Median Cut algorithm, pngnq-s9 is using NeuQuant. It often writes unnecessary entries in palette, that make PNG bigger, but seems to use a better sorting.

pngnqs9 -n 256 -Q f -s 1 myfile.png

pngnq-s9 converts the file to PNG Paletted using Floyd-Steinberg diffusion

pngnq-s9 is a good quantizer, but perhaps it makes sense to compare results with pngquant, specially with a reducer and compressor at output. Most of the time, the combination pngquant + PNGOUT give better size/quality ratio than pngnq-s9 + PNGOUT.

TruePNG by x128

Version tested: 0.4.0.9 — Type: Reducer / Quantizer

TruePNG is also a very good quantizer that can convert a PNG file to Paletted mode, or reduce the number of color without conversion. PNG-8 meets limitation because it can get only 256 colors, TruePNG is able to reduce colors keeping the original ColorType.

truepng -cq myfile.png

TruePNG converts to PNG Paletted (PNG-8)

TruePNG does one of the best compromise between size/quality, but is slower than pngquant. It also optimize file after quantization process, using a combination of palette sorting (up to 7), that can produce filtered Paletted, and/or PNG that have unnecessary values in tRNS, but smaller iDAT.

truepng -cq c=512 myfile.png

TruePNG reduces the number of colors to 512 (maximum) in the PNG file

TruePNG can reduce the number of colors in a PNG file without conversion to Paletted (PNG-8) mode. It can reduce file size significantly keeping the visual quality. It also does some reductions, as converting not-restitued colors before quantization.

Median Cut Posterizer by Kornel Lesiński

Version tested: 1.6 — Type: Reducer / Quantizer

Median Cut Posterizer reduces number of distinct color/alpha intensities in a PNG file. The goal of this tool is to make RGB/RGBA PNG images more compressible, assuming that lower number of unique byte values increases chance of finding repetition and improves efficiency of Huffman coding.

posterize -Q 100 "original.png" "posterized.png"

Median Cut Posterizer reduces the number of colors in a RGBA file

Median Cut Posterizer can be very efficient on realistic pictures, that make them more compressible. It can also use dithering to keep a better visual quality for others. A best quality/ratio can be done with TruePNG + Median Cut Posterizer combination.