Pngcrush is an optimizer for PNG (Portable Network Graphics) files. It can be run from a commandline in an MSDOS window, or from a UNIX or LINUX commandline.
Its main purpose is to reduce the size of the PNG IDAT datastream by trying various compression levels an PNG filter methods. It also can be used to remove unwanted ancillary chunks, or to add certain chunks including gAMA, tRNS, iCCP, and textual chunks.
Pngcrush, when statically linked to the supplied zlib code, is believed to be immune to the zlib-1.1.3 "double-free" bug, since by default it detects and rejects any "double-free" attempt. It merely generates a "Decompression Error" message and rejects the file.
Pngcrush is open source and may be used by anyone without fee.
The source code and binary executables for pngcrush are here. Pngcrush uses libpng and zlib, both of which are included in this pngcrush source distribution.
They are slightly modified:
* libpng's pngconf.h is modified to "#include pngcrush.h" which is used
o to "#define out" unused parts of the library
o #define PNG_SETJMP_NOT_SUPPORTED
o #define PNG_ABORT()
o to set the IDAT buffer size to a large value, and
* zlib is modified to set the TOO_FAR macro to 32767 in deflate.c
If you prefer, you can compile only pngcrush.c from the pngcrush source distribution and run it with the stock libpng and zlib, which can be found at the PNG web site, www.libpng.org/pub/png/. If you do this,
* The iTXt chunk will not be supported if your version of libpng does not support it. Libpng will start supporting the iTXt chunk by default with version 1.4.0.
* pngcrush will be vulnerable to various overflow conditions that were fixed in August 2004, if you use an unpatched libpng version earlier than version 1.2.7/1.0.17.
* pngcrush will be vulnerable to the zlib-1.1.3 double-free bug, if you link pngcrush with zlib-1.1.3 and a version of libpng such as any 1.0.x that does not have PNG_USER_MEM_SUPPORTED enabled.
* TOO_FAR will be 4096 instead of 32767 in deflate.c,
which will result in slightly larger files and slightly faster execution.
* also, you will be unable to read erroneous PNG files with "Too many IDAT's".
Precompiled binaries for Windows (runs in MSDOS window, built under DJGPP) and RISCOS platforms are here.
Download
Its main purpose is to reduce the size of the PNG IDAT datastream by trying various compression levels an PNG filter methods. It also can be used to remove unwanted ancillary chunks, or to add certain chunks including gAMA, tRNS, iCCP, and textual chunks.
Pngcrush, when statically linked to the supplied zlib code, is believed to be immune to the zlib-1.1.3 "double-free" bug, since by default it detects and rejects any "double-free" attempt. It merely generates a "Decompression Error" message and rejects the file.
Pngcrush is open source and may be used by anyone without fee.
The source code and binary executables for pngcrush are here. Pngcrush uses libpng and zlib, both of which are included in this pngcrush source distribution.
* libpng's pngconf.h is modified to "#include pngcrush.h" which is used
o to "#define out" unused parts of the library
o #define PNG_SETJMP_NOT_SUPPORTED
o #define PNG_ABORT()
o to set the IDAT buffer size to a large value, and
* zlib is modified to set the TOO_FAR macro to 32767 in deflate.c
* The iTXt chunk will not be supported if your version of libpng does not support it. Libpng will start supporting the iTXt chunk by default with version 1.4.0.
* pngcrush will be vulnerable to various overflow conditions that were fixed in August 2004, if you use an unpatched libpng version earlier than version 1.2.7/1.0.17.
* pngcrush will be vulnerable to the zlib-1.1.3 double-free bug, if you link pngcrush with zlib-1.1.3 and a version of libpng such as any 1.0.x that does not have PNG_USER_MEM_SUPPORTED enabled.
* TOO_FAR will be 4096 instead of 32767 in deflate.c,
which will result in slightly larger files and slightly faster execution.
* also, you will be unable to read erroneous PNG files with "Too many IDAT's".
Precompiled binaries for Windows (runs in MSDOS window, built under DJGPP) and RISCOS platforms are here.
If you liked this article, subscribe to the feed by clicking the image below to keep informed about new contents of the blog:
0 comments:
Post a Comment