pngcrush/libpng fails with " Wrote palette index exceeding num_palette"
Brought to you by:
glennrp
I'm using pngcrush for our website. Recently we updated from 1.7.83 to 1.8.10 and now some of our pngs cannot be compressed anymore.
I use the macOS executable from this repository: https://github.com/imagemin/pngcrush-bin/tree/master/vendor/osx
Output with pngcrush 1.8.10
| pngcrush-1.8.10
| Copyright (C) 1998-2002, 2006-2016 Glenn Randers-Pehrson
| Portions Copyright (C) 2005 Greg Roelofs
| This is a free, open-source program. Permission is irrevocably
| granted to everyone to use this version of pngcrush without
| payment of any fee.
| Executable name is pngcrush
| It was built with bundled libpng-1.6.26
| and is running with bundled libpng-1.6.26
| Copyright (C) 1998-2004, 2006-2016 Glenn Randers-Pehrson,
| Copyright (C) 1996, 1997 Andreas Dilger,
| Copyright (C) 1995, Guy Eric Schalnat, Group 42 Inc.,
| and bundled zlib-1.2.8.1-motley, Copyright (C) 1995 (or later),
| Jean-loup Gailly and Mark Adler,
| and using "clock()".
| It was compiled with gcc version 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1).
Recompressing IDAT chunks in input.png to test.png
Total length of data found in critical chunks = 754
While converting input.png to test.png:
pngcrush caught libpng error:
Wrote palette index exceeding num_palette
Critical chunk length, method 150 (ws 14 fm 0 zl 4 zs 0) = 854
CPU time decode 0.000622, encode 0.000896, other 0.001590, total 0.003848 sec
Output with 1.7.83
| pngcrush 1.7.83
| Copyright (C) 1998-2002, 2006-2015 Glenn Randers-Pehrson
| Portions copyright (C) 2005 Greg Roelofs
| This is a free, open-source program. Permission is irrevocably
| granted to everyone to use this version of pngcrush without
| payment of any fee.
| Executable name is pngcrush_17
| It was built with libpng version 1.6.16, and is
| running with libpng version 1.6.16 - December 22, 2014
| Copyright (C) 1998-2004, 2006-2015 Glenn Randers-Pehrson,
| Copyright (C) 1996, 1997 Andreas Dilger,
| Copyright (C) 1995, Guy Eric Schalnat, Group 42 Inc.,
| and zlib version 1.2.8, Copyright (C) 1995-2013,
| Jean-loup Gailly and Mark Adler.
| It was compiled with gcc version 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56).
Recompressing IDAT chunks in input.png
Total length of data found in critical chunks = 754
Critical chunk length, method 1 (ws 14 fm 0 zl 4 zs 0) = 866
Critical chunk length, method 2 (ws 14 fm 1 zl 4 zs 0) > 866
Critical chunk length, method 3 (ws 14 fm 5 zl 4 zs 1) > 866
Critical chunk length, method 4 (ws 14 fm 0 zl 9 zs 1) = 842
Critical chunk length, method 7 (ws 14 fm 0 zl 9 zs 0) = 815
Best pngcrush method = 0 (settings undetermined)
for output to test.png
(no critical chunk change)
(no filesize change)
CPU time decoding 0.001, encoding 0.003, other 0.001, total 0.006 sec.
The file is attached.
Just noticed the same also happens with 1.7.83 if I use the -reduce flag