Change log: Version 1.6.10 (built with libpng-1.2.31 and zlib-1.2.3.2) Add sTER chunk support. Version 1.6.9 (built with libpng-1.2.31 and zlib-1.2.3.2) Updated cexcept.h to version 2.0.1 Add missing curly brackets. Version 1.6.8 (built with libpng-1.2.29 and zlib-1.2.3.2) Fixed bug with handling of -z and -zi options. Version 1.6.7 (built with libpng-1.2.29 and zlib-1.2.3.2) Moved PNG_UINT_CHNK and some other defines from pngcrush.h to pngcrush.c Reject invalid color_type or bit_depth. Version 1.6.6 (built with libpng-1.2.29 and zlib-1.2.3.2) Added dSIG support. Pngcrush will not rewrite an image containing a dSIG chunk immediately following the IHDR chunk, unless the dSIG is explicitly removed with "-rem dSIG" or explicitly kept with "-keep dSIG". In the latter case the saved dSIG chunks will become invalid if any changes are made to the datastream. Fixed bug in writing unknown chunks from the end_info_ptr. Version 1.6.5 (built with libpng-1.2.29 and zlib-1.2.3.2) Discontinued adding a new gAMA chunk when writing sRGB chunk. Version 1.6.4 (built with libpng-1.2.9rc1 and zlib-1.2.3) Fixed bug in handling of undocumented -trns_a option (Michal Politowski). Fixed bug with "nosave" handling of unknown chunks. Version 1.6.3 (built with libpng-1.2.9beta11 and zlib-1.2.3) Fixed documentation of iTXt input (Shlomi Tal). Removed #define PNG_INTERNAL and provided prototypes for some internal libpng functions that are duplicated in pngcrush.c Version 1.6.2 (built with libpng-1.2.8 and zlib-1.2.3) Fixed bug with "PNG_ROWBYTES" usage, introduced in version 1.6.0. The bug could cause a crash and only affects the "nolib" builds. Converted C++ style (// ...) comments to C style (/* ... */). Defined TOO_FAR == 32767 in deflate.c (again). The definition was omitted from version 1.6.0 when zlib was upgraded to version 1.2.3. Version 1.6.1 (distributed as 1.6.0, built with libpng-1.2.8 and zlib-1.2.3) Copied non-exported libpng functions from libpng into pngcrush, to make pngcrush play more nicely with shared libpng. These are #ifdef'ed out when a static library is being built with the bundled libpng and pngcrush.h is included. Version 1.6.0-grr (built with libpng-1.2.4 and zlib-1.1.4pc or zlib-1.2.2) Moved ChangeLog out of pngcrush.c comments and into a separate file. Filtered pngcrush.c through "indent -kr" and "expand" for readability. Moved 550 lines of usage/help/copyright/license/version info to separate function(s) and cleaned up significantly. Added some comments for ease of navigation and readability. Stripped out a bunch of ancient-libpng compatibility stuff. Defined PNG_UINT_* macros (pngcrush.h for now). Fixed unknown-chunk handling ("-rem alla" and "-rem gifx" now work). Created modified version of makefile that supports external zlib. Added support for methods using Z_RLE zlib strategy (zlib 1.2.x only). Documented -huffman option in usage screen. Added IDAT statistics to final per-file summary. Added utime() support to give output files same timestamps as input files. Version 1.5.10 (built with libpng-1.2.4 and zlib-1.1.4pc) Fixed bug, introduced in 1.5.9, that caused defaults for method 0 to be used instead of copying the original image, when the original was already smallest. Version 1.5.9 (built with libpng-1.2.4beta3 and zlib-1.1.4pc) Work around CPU timer wraparound at 2G microseconds. Upgraded zlib from 1.1.3 to 1.1.4. Pngcrush is believed not to be vulnerable to the zlib-1.1.3 buffer-overflow bug. Choose the first instance of smallest IDAT instead of the last, for faster final recompression, suggested by TSamuel. Version 1.5.8 (built with libpng-1.2.1) Added -trns_a option for entering a tRNS array. Version 1.5.7 (built with libpng-1.2.0) Added setargv.obj to Makefile.msc to expand wildcards, e.g., *.png Use constant string "pngcrush" instead of argv[0] when appropriate. Only check stats for infile==outfile once per input file, or not at all if "-nofilecheck" option is present or if a directory was created. Fixed bugs with changing bit_depth of grayscale images. Version 1.5.6 (built with libpng-1.0.12) Eliminated extra "Removed the cHNK chunk" messages generated by version 1.5.5 when "-rem alla" or "-rem allb" is used. All unknown chunks including safe-to-copy chunks are now removed in response to the "-rem alla" or "-rem allb" options. Issue a warning if the user tries "-cc" option when it is not supported. Version 1.5.5 (built with libpng-1.0.12) Reset reduce_to_gray and it_is_opaque flags prior to processing each image. Enable removal of safe-to-copy chunks that are being handled as unknown e.g., "-rem time". Version 1.5.4 (built with libpng-1.0.11) Added 262 to the length of uncompressed data when calculating required_window_size, to account for zlib/deflate implementation. Added "-bit_depth n" to the help screen. Call png_set_packing() when increasing bit_depth to 2 or 4. Added warning about not overwriting an existing tRNS chunk. Reduced the memory usage Write 500K IDAT chunks even when system libpng is being used. Ignore all-zero cHRM chunks, with a warning. Version 1.5.3 (built with libpng-1.0.9beta5) Added "-loco" option (writes MNG files with filter_method 64) "-dir" and "-ext" options are no longer mutually exclusive, e.g.: pngcrush -loco -dir Crushed -ext .mng *.png Version 1.5.2 (built with libpng-1.0.9beta1) Added "-iccp" option. Increased the zlib memory level, which improves compression (typically about 1.3 percent for photos) at the expense of increased memory usage. Enabled the "-max max_idat_size" option, even when max_idat_size exceeds the default 1/2 megabyte size. Added missing "png_ptr" argument to png_error() call Added "-loco" option, to enable the LOCO color transformation (R->R-G, G, B->B-G) while writing a MNG with filter_method 64. Undo the transformation and write the regular PNG filter_method (0) if the MNG filter_method 64 is detected. Revised the "-help" output slightly and improved the "-version" output. The "-already[_crushed]" option is now ignored if the "-force" option is present or if chunks are being added, deleted, or modified. Improved "things_have_changed" behavior (now, when set in a particular file, it is not set for all remaining files) Version 1.5.1 (built with libpng-1.0.8) Disabled color counting by default and made it controllable with new -cc and -no_cc commandline arguments. Added some #ifdef PNGCRUSH_COUNT_COLORS around code that needs it. Revised count_colors() attempting to avoid stack corruption that has been observed on RedHat 6.2 Added the word "irrevocably" to the license and changed "without fee" to "without payment of any fee". Version 1.5.0 (built with libpng-1.0.8) After encountering an image with a bad Photoshop iCCP chunk, pngcrush 1.4.5 through 1.4.8 write sRGB and gAMA=45455 chunks in all remaining PNG files on the command line. This has been fixed so the correction is only applied to the particular bad input file. Version 1.4.8 (built with libpng-1.0.8rc1) Detect and remove all-opaque alpha channel. Detect and reduce all-gray truecolor images to grayscale. Version 1.4.7 (built with libpng-1.0.8rc1) Restored the "-ext" option that was inadvertently overridden with a new "-exit" option in version 1.4.6 ("-exit" is used to force an "exit" instead of a "return" from the main program). Version 1.4.6 (built with libpng-1.0.8rc1) Fixed bug in color-counting of noninterlaced images. Added capability of processing multiple rows at a time (disabled by default because it turns out to be no faster). Replaced "return" statements in main() with "exit" statements. Force exit instead of return with "-exit" argument. Added the UCITA disclaimers to the help output. Version 1.4.5 (built with libpng-1.0.7rc2 and cexcept-1.0.0) Added color-counting and palette-building capability (enable by defining PNGCRUSH_COUNT_COLORS). In a future version, this will give pngcrush the ability to reduce RGBA images to indexed-color or grayscale when fewer than 257 RGBA combinations are present, and no color is present that requires 16-bit precision. For now, it only reports the frequencies. Added "-fix" option, for fixing bad CRC's and other correctable conditions. Write sBIT.alpha=1 when adding an opaque alpha channel and sBIT is present. Identify the erroneous 2615-byte sRGB monitor profile being written by Photoshop 5.5, which causes many apps to crash, and replace it with an sRGB chunk. Added a check for input and output on different devices before rejecting the output file as being the same as the input file based on inode. Added some UCITA language to the disclaimer. Version 1.4.4 (built with libpng-1.0.6i and cexcept-0.6.3) Can be built on RISC OS platforms, thanks to Darren Salt. Version 1.4.3 (built with libpng-1.0.6h and cexcept-0.6.3) Reduced scope of Try/Catch blocks to avoid nesting them, and removed returns from within the Try blocks, where they are not allowed. Removed direct access to the png structure when possible, and isolated the remaining direct accesses to the png structure into new png_get_compression_buffer_size(), png_set_compression_buffer_size(), and png_set_unknown_chunk_location() functions that were installed in libpng version 1.0.6g. Version 1.4.2 (built with libpng-1.0.6f and cexcept-0.6.0) Removes extra IDAT chunks (such as found in some POV-ray PNGs) with a warning instead of bailing out (this feature requires libpng-1.0.6f or later, compiled with "#define PNG_ABORT()"). Removed old setjmp interface entirely. Version 1.4.1 (built with libpng-1.0.6e and cexcept-0.6.0) Uses cexcept.h for error handling instead of libpng's built-in setjmp/longjmp mechanism. See http://cexcept.sf.net/ Pngcrush.c will now run when compiled with old versions of libpng back to version 0.96, although some features will not be available. Version 1.4.0 (built with libpng-1.0.6 + libpng-1.0.6-patch-a) Version 1.3.6 (built with libpng-1.0.5v) RGB to Grayscale conversion is more accurate (15-bit instead of 8-bit) and now uses only integer arithmetic. #ifdef'ed out PNG_READ_DITHER Changed "Compressed" to "Uncompressed" in help for -itxt. Stifled some compiler warnings Version 1.3.5 (built with libpng-1.0.5s) Add test on stat_buf.st_size to verify fpin==fpout, because stat in MSVC++6.0 standard version returns stat_buf.st_ino=0 for all files. Revised pngcrush.h to make it easier to control PNG_ZBUF_SIZE and PNG_NO_FLOATING_POINT_SUPPORTED from a makefile. Restored ability to enter "replace_gamma" value as a float even when floating point arithmetic is not enabled. Enabled removing tEXt, zTXt, or iTXt chunks by chunk type, i.e., "-rem tEXt" only removes tEXt chunks, while "-rem text" removes all three types of text chunk. Removed definition of TOO_FAR from pngcrush.h Uses new libpng error handler; if a file has errors, pngcrush now will continue on and compress the remaining files instead of bailing out. Version 1.3.4 (built with libpng-1.0.5m) Do not allow pngcrush to overwrite the input file. Version 1.3.3 (built with libpng-1.0.5m) Restored ability to enter gamma as a float even when floating point arithmetic is not enabled. Version 1.3.2 (built with libpng-1.0.5k) Renamed "dirname" to "directory_name" to avoid conflict with "dirname" that appears in string.h on some platforms. Fixed "PNG_NO_FLOAING_POINT" typo in pngcrush.h #ifdef'ed out parts of the help screen for options that are unsupported. Version 1.3.1 (built with libpng-1.0.5k): Eliminated some spurious warnings that were being issued by libpng-1.0.5j. Added -itxt, -ztxt, and -zitxt descriptions to the help screen. Dropped explicit support for pCAL, hIST, sCAL, sPLT, iCCP, tIME, and cHRM chunks and handle them as unknown but safe-to-copy instead, using new png_handle_as_unknown function available in libpng-1.0.5k. Version 1.3.0 (built with libpng-1.0.5j): Added support for handling unknown chunks. pngcrush is now fixed-point only, unless PNG_NO_FLOATING_POINT_SUPPORTED is undefined in pngcrush.h. Added support for the iCCP, iTXt, sCAL, and sPLT chunks, which are now supported by libpng (since libpng-1.0.5j). None of these have been adequately tested. #ifdef'ed out more unused code (weighted filters and progressive read; this saves about 15k in the size of the executable). Moved the special definitions from pngconf.h into a new pngcrush.h Disallow 256-byte compression window size when writing, to work around an apparent zlib bug. Either deflate was producing incorrect results in a 21x21 4-bit image or inflate was decoding it incorrectly; the uncompressed stream is 252 bytes, which is uncomfortably close to the resulting 256-byte compression window. This workaround can be removed when zlib is fixed. The "-m method" can be used any of the 124 methods, without having to specify the filter, level, and strategy, instead of just the first 10. Version 1.2.1 (built with libpng-1.0.5f): Fixed -srgb parameter so it really does take an argument, and so it continues to use "0" if an integer does not follow the -srgb. Added "-plte_len n" argument for truncating the PLTE. Be sure not to truncate it to less than the greatest index actually appearing in IDAT. Version 1.2.0: Removed registration requirement. Added open source license. Redefined TOO_FAR=32k in deflate.c. Changes prior to going "open source": Version 1.1.8: built with libpng-1.0.5a. Runs OK with pngvcrd.c. Version 1.1.7: added ability to add tEXt/zTXt chunks. Fixed bug with closing a file that wasn't opened when using "pngcrush -n". Fixed bug with tEXt/zTXt chunks after IDAT not being copied. Added alpha to the displayed palette table. Rebuilt with libpng-1.0.5. Version 1.1.6: fixed bug with one file left open after each image is processed Version 1.1.5: Shorten or remove tRNS chunks that are all opaque or have opaque entries at the end. Added timing report. Version 1.1.4: added ability to restrict brute_force to one or more filter types, compression levels, or compression strategies.