pngcrush changelog

    Change log:

    Version 1.7.90 (built with libpng-1.6.20 and zlib-1.2.8)
      Suppress warning about "damaged LZ stream" when bailing out and building
        with libpng-1.7.0beta.
      Added a LICENSE file to the distribution. It points to the actual
        license appearing in the NOTICES section near the top of pngcrush.c
      Show if pngcrush is built with bundled or system libpng and zlib.
      Fixed segfault while writing a -loco MNG (bug found with AFL, reported
        by Brian Carpenter).

    Version 1.7.89 (built with libpng-1.6.20 and zlib-1.2.8)

    Version 1.7.88 (built with libpng-1.6.19 and zlib-1.2.8)
      Eliminated a potential overflow while adding iTXt chunk (over-length
        text_lang or text_lang_key), reported by Coverity.

    Version 1.7.87 (built with libpng-1.6.18 and zlib-1.2.8)
      Fixed a double-free bug (CVE-2015-7700). There was a "free" of the
        sPLT chunk structure in pngcrush and then again in png.c (Bug report
        by Brian Carpenter).
      Added common-law trademark notice and export control information.
      Rearranged some paragraphs in the comments at the beginning of pngcrush.c
      Increased some buffer sizes in an attempt to prevent possible overflows.

    Version 1.7.86 (built with libpng-1.6.18 and zlib-1.2.8)
      Increased maximum size of a text chunk input from 260 to 2048
        (STR_BUF_SIZE) bytes, to agree with the help screen (bug report by
        Tamas Jursonovics).
      Fixed bug that caused text chunks after IDAT to be written only when
        the "-save" option is used.

    Version 1.7.85 (built with libpng-1.6.16 and zlib-1.2.8)
      Improved reporting of invalid chunk names. Does not try to put
        non-printable characters in STDERR; displays hex numbers instead.
      Fixed include path for utime.h on MSVC (Louis McLaughlin).
      Eliminated "FAR" memory support (it was removed from libpng at version
        1.6.0).
      Disabled the "-already_crushed" option which does not really work well.

    Version 1.7.84 (built with libpng-1.6.16 and zlib-1.2.8)
      Cleaned up more Coverity-scan warnings. Fixing those also fixed
        CVE-2015-2158.

    Version 1.7.83 (built with libpng-1.6.16 and zlib-1.2.8)
      Cleaned up some Coverity-scan warnings.  Unfortunately one of these
        changes introduced the vulnerability reported in CVE-2015-2158.

    Version 1.7.82 (built with libpng-1.6.16 and zlib-1.2.8)

    Version 1.7.81 (built with libpng-1.6.15 and zlib-1.2.8)
      Fixed off-by-one error in calculation of plte_len. Bug reports by
        Ivan Kuchin and Frederic Kayser.

    Version 1.7.80 (built with libpng-1.6.14 and zlib-1.2.8)
      Added "-reduce_palette" and "-noreduce_palette" options.  Enable
        reduce_palette when the "-new" or "-reduce" option is used.

    Version 1.7.79 (built with libpng-1.6.14 and zlib-1.2.8)
      Fixed bug in -plte_len N option.

    Version 1.7.78 (built with libpng-1.6.14 and zlib-1.2.8)
      Made "-s" and "-silent" options suppress libpng warnings.

    Version 1.7.77 (built with libpng-1.6.13 and zlib-1.2.8)
      Updated libpng to version 1.6.13.

    Version 1.7.76 (built with libpng-1.6.12 and zlib-1.2.8)
      Updated libpng to version 1.6.12.

    Version 1.7.75 (built with libpng-1.6.10 and zlib-1.2.8)
      Reverted libpng to version 1.6.10 due to a misplaced statement in png.c

    Version 1.7.74 (built with libpng-1.6.11 and zlib-1.2.8)
      Fixed "-zmem" option (only "-zm" would work since version 1.7.62).

    Version 1.7.73 (built with libpng-1.6.10 and zlib-1.2.8)
      Restored calls to png_set_crc_action() which had been removed from
        version 1.7.72 for some testing and inadvertently not restored.
      Changed "fix" internal variable name to "salvage" (still set with "-fix")
      Added code to fix/salvage PNG with "bad adaptive filter value" error.
      Avoid calculating CRC during compression trials except for the last trial,
        when the output is actually written.
      Fixed a bug with reducing 16-bit images to 8-bit using "-reduce" option.

    Version 1.7.72 (built with libpng-1.6.10 and zlib-1.2.8)

    Version 1.7.71 (built with libpng-1.6.9 and zlib-1.2.8)
      Built the Windows binaries using -DTOO_FAR=32767; neglected to do this
        in versions 1.7.42 through 1.7.70, which caused the Windows binaries
        to produce different (usually a few bytes larger) results than Linux.
        Thanks to F. Kayser for reporting the discrepancy.

    Version 1.7.70 (built with libpng-1.6.8 and zlib-1.2.8)

    Version 1.7.69 (built with libpng-1.6.6 and zlib-1.2.8)
      Updated libpng to version 1.6.6.

    Version 1.7.68 (built with libpng-1.6.4 and zlib-1.2.8)
      Check for NULL return from malloc().
      Undefine CLOCKS_PER_SECOND "1000" found in some version of MinGW.
      Replaced most "atoi(argv[++i])" with "pngcrush_get_long" which does
        "BUMP_I; strtol(argv[i],ptr,10)" and added pngcrush_check_long macro
        to detect malformed or missing parameters (debian bug 716149).
      Added global_things_have_changed=1 when reading -bkgd.
      The "-bit_depth N" option did not work reliably and has been removed.

    Version 1.7.67 (built with libpng-1.5.17 and zlib-1.2.8)
      Fixed handling of "-text" and "-ztext" options for text input. They had been
        reduced to "-t" and "-z" with an incorrect argument (3 instead of 2) in
        version 1.7.62. Bug report and patch from Tsukasa Oi.

    Version 1.7.66 (built with libpng-1.5.17 and zlib-1.2.8)
      Revised pngcrush_examine_pixels_fn() to fix some incorrect reductions.

    Version 1.7.65 (built with libpng-1.5.17 and zlib-1.2.8)
      Do not allow any colortype or depth reductions if acTL is present.
      Added warnings to explain why any requested reductions were not allowed.

    Version 1.7.64 (built with libpng-1.5.17 and zlib-1.2.8)

    Version 1.7.63 (built with libpng-1.5.16 and zlib-1.2.8)
      Add "int dowildcard=-1;" in an attempt to get wildcard arguments working
        in the cross-compiled MinGW executables.

    Version 1.7.62 (built with libpng-1.5.16 and zlib-1.2.8)
      Remove old filename before renaming, when using the "-ow" option on
        any Windows platform, not just CYGWIN (see log entry for pngcrush-1.7.43).
      Reverted error with handling single-character options like "-v", introduced
        in 1.7.61.

    Version 1.7.61 (built with libpng-1.5.16 and zlib-1.2.8)
      Check sBIT chunk data to see if reduction to gray or to 8-bit is permitted,
        i.e., the RGB sBIT values are equal to each other or the sBIT values are
        not greater than 8, respectively.
      Do not try to make_opaque if the tRNS chunk is found.
      Added warning when ignoring an invalid commandline option.
      Improved brute_force handling with specified level, filter, or strategy.

    Version 1.7.60 (built with libpng-1.5.16 and zlib-1.2.8)
      Revise -reduce so reducing from color-type 6 to grayscale works.
      Issue a warning if reducing bit depth or color type would violate various
        chunk dependencies, and do not perform the action:
        Do not reduce to grayscale if a color bKGD chunk, sBIT or iCCP chunk
           is present.
        Do not reduce bit depth if bKGD or sBIT chunk is present.
        Do not reduce palette length if the hIST chunk is present.
      Set "found_iCCP" flag to zero to avoid re-reading a bad iCCP chunk.

    Version 1.7.59 (built with libpng-1.5.16 and zlib-1.2.8)
      Show the acTL chunk in the chunk list in verbose output.
      Fixed several bugs reported by pornel at users.sf.net:
        Do not call png_set_benign_errors when PNG_BENIGN_ERRORS_SUPPORTED
          is not defined
        Renamed PNG_UNUSED() macro PNGCRUSH_UNUSED().
        Moved a closing bracket inside the PNGCRUSH_LOCO block.
        Moved the declaration of "new_mng" outside a PNGCRUSH_LOCO block.
        Put reference to "input_format" inside a PNGCRUSH_LOCO block.
        Moved declarations of mng_out and mngname inside a PNGCRUSH_LOGO block.

    Version 1.7.58 (built with libpng-1.5.15 and zlib-1.2.7-1)
      Do not enable reduce_palette by default for "-reduce", "-new", or "-old".
        It still is failing for some files.

    Version 1.7.57 (built with libpng-1.5.15 and zlib-1.2.7-1)
      Added "-new" option that turns on "-reduce" and "-force" which will be
        the default settings for version 1.8.0 and beyond.
      Added "-old" option that turns off "-reduce" and "-force" which are the
        current default settings.
      Updated copyright year for zlib-1.2.7-1.
      Reverted to libpng-1.5.15 to be able to read old PNG files with TOO FAR
        errors.  This will of course only work with the embedded libpng.

    Version 1.7.56 (built with libpng-1.6.1 and zlib-1.2.7-1)
      Only use pngcrush_debug_malloc() and pngcrush_debug_free() if the result
        is going to be shown.
      Added PNG_PASS_ROWS, PNG_UNUSED, and other macro definitions, when building
        with libpng-1.4.x and older libpng versions.
      Multiplied rowbytes by 8/bit_depth when using the system library because
        we do not call png_read_transform_info(). This prevents a crash when
        reading sub-8-bit input files.

    Version 1.7.55 (built with libpng-1.6.1 and zlib-1.2.7-1)

    Version 1.7.54 (built with libpng-1.6.1rc01 and zlib-1.2.7-1)

    Version 1.7.53 (built with libpng-1.6.1rc01 and zlib-1.2.7)
      Removed plte_len stuff from the "To do" list because it is done.
      Shorten the indexed-PNG tRNS chunk length if it has more entries than the PLTE chunk.

    Version 1.7.52 (built with libpng-1.6.1beta06 and zlib-1.2.7)
      Added license info for cexcept.h, libpng, and zlib.
      Added consideration of "zopfli" compression to the "To do" list.
      Fixed a typo that caused a cHRM chunk to be "found" if an iCCP chunk
        were present.
      Reset best_byte_count before trial loop.
      Revise global png_set_keep_unknown_chunks() calls to avoid a libpng16
        warning.
      Reset "intent" to "specified_intent" before trial loop.
      Reset "plte_len" to "specified_plte_len" before trial loop.
      Initialize length of each trial to 0x7fffffff so any untried method
        is not the "best method".

    Version 1.7.51 (built with libpng-1.6.0 and zlib-1.2.7)
      Added "-noreduce" option, in preparation for "-reduce" becoming the
        default behaviour in version 1.8.0.  This turns off lossless bit depth,
        color type, palette reduction, and opaque alpha channel removal.
      Zero out the high byte of transparent color for color-type 0 and 2,
        when reducing from 16 bits to 8.
      Undefined a bunch of stuff in pngcrush.h that we do not use, saves about
        100 kbytes of executable file size in addition to about 50k saved by
        undefining the simplified API.
      Fixed double-underscore typo in an #ifdef in png.c
      If "-reduce" is on and the background index is larger than the reduced
        palette_length+1, reduce it to the palette_length+1.
      Increased required_window_size if necessary to account for slightly larger
        size of interlaced files due to additional filter bytes and padding.

    Version 1.7.50 (built with libpng-1.6.0 and zlib-1.2.7)
      Removed completed items from the "To do" list.
      Ignore the argument of the "plte_len" argument and just set the
        "reduce_palette" flag.

    Version 1.7.49 (built with libpng-1.5.14 and zlib-1.2.7)
      Use png_set_benign_errors() to allow certain errors in the input file
        to be handled as warnings.
      Skip PNG_ABORT redefinition when using libpng-1.4.0 and later.
      Implemented "-reduce" option to identify and reduce all-gray images,
        all-opaque images, unused PLTE entries, and 16-bit images that can be
        reduced losslessly to 8-bit.

    Version 1.7.48 (built with libpng-1.5.14 and zlib-1.2.7)
      Reserved method==0 for examining the pixels during trial 0, if necessary.
        Changed blacken_fn() to separate pngcrush_examine_pixels_fn() and
        pngcrush_transform_pixels_fn() callback functions.  The "examine"
        function is only done during trial 0; it sets a flag whether
        any fully transparent pixels were found, and pngcrush only runs
        pngcrush_transform_pixels_fn() if necessary.
      This is in preparation for future versions, which will examine other
        conditions such as if the image is opaque or gray or can be losslessly
        reduced in bit depth, set flags in trial 0 and accomplish the
        transformations in the remaining trials (see the To do list starting
        about line 200 in the pngcrush.c source).
      Removed "PNGCRUSH_COUNT_COLORS" blocks again.

    Version 1.7.47 (built with libpng-1.5.13 and zlib-1.2.7)
      Do not do the heuristic trials of the first 10 methods when -brute is
        specified, because it did not save time as I hoped.
      Fixed a mistake in 1.7.45 and 1.7.46 that caused the output file to
        not be written.

    Version 1.7.46 (built with libpng-1.5.13 and zlib-1.2.7)
      Moved the new level 0 methods to the end of the trial list (methods 137-148)

    Version 1.7.45 (built with libpng-1.5.13 and zlib-1.2.7)
      Added method 0 (uncompressed). "-m 0" now simply turns on method 0.
      Added "-try10" option that has the same effect that "-m 0" previously did,
        namely to try only the first ten methods.
      Inserted new methods 17 through 21 with zlib level 0.
      Do the heuristic trials of the first 10 methods when -brute is specified,
        to get quickly to a small solution, so we can bail out of most of the
        remaining trials early. Previously these 10 methods were skipped during
        a -brute run.
      Removed the "-reduce" line from the help screen when PNGCRUSH_COUNT_COLORS
        is disabled.

    Version 1.7.44 (built with libpng-1.5.14 and zlib-1.2.7)

    Version 1.7.43 (built with libpng-1.5.13 and zlib-1.2.7)
      Added "remove(inname)" before "rename(outname, inname)" when using the "-ow"
        option on CYGWIN/MinGW because "rename()" does not work if the target file
        exists.
      Use the bundled "zlib.h" when PNGCRUSH_H is defined, otherwise use the
        system .

    Version 1.7.42 (built with libpng-1.5.13 and zlib-1.2.7)
      Use malloc() and free() instead of png_malloc_default() and
        png_free_default().  This will be required to run with libpng-1.7.x.
      Revised the PNG_ABORT definition in pngcrush.h to work with libpng-1.7.x.
      Revised zutil.h to avoid redefining ptrdiff_t on MinGW/CYGWIN platforms.

    Version 1.7.41 (built with libpng-1.5.13 and zlib-1.2.7)
      Reverted to version 1.7.38.  Versions 1.7.39 and 1.7.40 failed to
        open an output file.

    Version 1.7.40 (built with libpng-1.5.13 and zlib-1.2.7)
      Revised the "To do" list.

    Version 1.7.39 (built with libpng-1.5.13 and zlib-1.2.7)
      Removed "PNGCRUSH_COUNT_COLORS" blocks which I no longer intend to
        implement because that feature is already available in ImageMagick.  Kept
        "reduce_to_gray" and "it_is_opaque" flags which I do hope to implement
        soon.
      Changed NULL to pngcrush_default_read_data in png_set_read_fn() calls, to fix
        an insignificant error introduced in pngcrush-1.7.14, that caused most
        reads to not go through the alternate read function.  Also always set this
        function, instead of depending on STDIO_SUPPORTED.

    Version 1.7.38 (built with libpng-1.5.13 and zlib-1.2.7)
      Bail out of a trial if byte count exceeds best byte count so far.  This
        avoids wasting CPU time on trial compressions of trials that exceed the
        best compression found so far.
      Added -bail and -nobail options.  Use -nobail to get a complete report
        of filesizes; otherwise the report just says ">N" for any trial
        that exceeds size N where N is the best size achieved so far.
      Added -blacken option, to enable changing the color samples of any
        fully-transparent pixels to zero in PNG files with color-type 4 or 6,
        potentially improving their compressibility. Note that this is an
        irreversible lossy change: the underlying colors of all fully transparent
        pixels are lost, if they were not already black.

    Version 1.7.37 (built with libpng-1.5.12 and zlib-1.2.7)
      Reverted pngcrush.c back to 1.7.35 and fixed the bug with PLTE handling.

    Version 1.7.36 (built with libpng-1.5.12 and zlib-1.2.7)
      Reverted pngcrush.c to version 1.7.34 because pngcrush is failing with
        some paletted PNGs.
      Separated CFLAGS and CPPFLAGS in the makefile (with "-I" and "-DZ_SOLO"
        in CPPFLAGS)

    Version 1.7.35 (built with libpng-1.5.12 and zlib-1.2.7)
      Removed FOPEN of fpout except for the last trial.  The open files caused
        "pngcrush -brute -e _ext.png *.png" to fail on the 10th file (about the
        1024th compression trial) due to being unable to open the output file.

    Version 1.7.34 (built with libpng-1.5.12 and zlib-1.2.7)
      Compute and report sum of critical chunk lengths IHDR, PLTE, IDAT, and IEND,
        plus the 8-byte PNG signature instead of just the total IDAT data length.
        Simplify finding the lengths from the trial compressions, by replacing
        the write function with one that simply counts the bytes that would have
        been written to a trial PNG, instead of actually writing a PNG, reading it
        back, and counting the IDAT bytes.
      Removed comments about the system library having to be libpng14 or earlier.
        This restriction was fixed in version 1.7.20.

    Version 1.7.33  (built with libpng-1.5.12 and zlib-1.2.7)
      Ignore all ancillary chunks except during the final trial.  This can be
        significantly faster when large ancillary chunks such as iCCP and zTXt
        are present.

    Version 1.7.32  (built with libpng-1.5.12 and zlib-1.2.7)
      Fixed bug introduced in 1.7.30: Do not call png_set_check_for_invalid_index()
        when nosave != 0 (otherwise pngcrush crashes with the "-n" option).

    Version 1.7.31  (built with libpng-1.5.11 and zlib-1.2.7)
      Dropped *.tar.bz2 from distribution.
      Added a comma that was missing from one of the "usage" strings (error
        introduced in version 1.7.29).

    Version 1.7.30  (built with libpng-1.5.11 and zlib-1.2.7)
      Only run the new (in libpng-1.5.10) test of palette indexes during the
        first trial.

    Version 1.7.29  (built with libpng-1.5.10 and zlib-1.2.7)
      Set "things_have_changed" flag when adding text chunks, so the "-force"
        option is no longer necessary when adding text to an already-compressed
        file.
      Direct usage message and error messages to stderr instead of stdout. If
        anyone is still using DOS they may have to change the "if 0" at line
        990 to "if 1".  If you need to have the messages on standard output
        as in the past, use 2>&1 to redirect them.
      Added "pngcrush -n -v files.png" to the usage message.

    Version 1.7.28  (built with libpng-1.5.10 and zlib-1.2.7)
      Write proper copyright year for zlib, depending upon ZLIB_VERNUM

    Version 1.7.27  (built with libpng-1.5.10 and zlib-1.2.6)
      Increased row_buf malloc to row_bytes+64 instead of row_bytes+16, to
        match the size of big_row_buf in pngrutil.c (it is 48 in libpng14, 15, 16,
        and 64 in libpng10, 12.  Otherwise there is a double-free crash when the
        row_buf is destroyed.

    Version 1.7.26  (built with libpng-1.5.10 and zlib-1.2.6)
      Increased the text_text buffer from 2048 to 10*2048 (Ralph Giles), and
        changed an incorrect test for keyword length "< 180" to "< 80".  The
        text_text buffer was inadvertently reduced from 20480 to 2048 in
        pngcrush-1.7.9.
      Added -DZ_SOLO to CFLAGS, needed to compile zlib-1.2.6.
      Changed user limits to width and height max 500000, malloc max 2MB,
        cache max 500.
      Added -nolimits option which sets the user limits to the default
        unlimited values.

    Version 1.7.25  (built with libpng-1.5.9 and zlib-1.2.5)

    Version 1.7.24  (built with libpng-1.5.7 and zlib-1.2.5)
      Do not append a slash to the directory name if it already has one.

    Version 1.7.23  (built with libpng-1.5.7 and zlib-1.2.5)
      Ignore any attempt to use "-ow" with the "-d" or "-e" options, with warning.
      Include zlib.h if ZLIB_H is not defined (instead of checking the libpng
        version; see entry below for pngcrush-1.7.14), and include string.h
        if _STRING_H_ is not defined (because libpng-1.6 does not include string.h)
      Define SLASH = backslash on Windows platforms so the "-d" option will work..

    Version 1.7.22  (built with libpng-1.5.6 and zlib-1.2.5)
      Added "-ow" (overwrite) option.  The input file is overwritten and the
        output file is just used temporarily and removed after it is copied
        over the input file..  If you do not specify an output file, "pngout.png"
        is used as the temporary file. Caution: the temporary file must be on
        the same filesystem as the input file.  Contributed by a group of students
        of the University of Paris who were taking the "Understanding of Programs"
        course and wished to gain familiarity with an open-source program.

    Version 1.7.21  (built with libpng-1.5.6 and zlib-1.2.5)
      Defined TOO_FAR=32767 in Makefile (instead of in pngcrush.h)

    Version 1.7.20  (built with libpng-1.5.5 and zlib-1.2.5)
      Removed the call to png_read_transform_info() when the system libpng
        is being used, so it can be built with a system libpng.

    Version 1.7.19  (built with libpng-1.5.5 and zlib-1.2.5)
      pngcrush-1.7.18 failed to read interlaced PNGs.  Reverted the change
        from calling png_read_transform_info() to png_read_update_info().
        Since png_read_transform_info() is not exported we again cannot build
        with the system libpng15.

    Version 1.7.18  (built with libpng-1.5.5 and zlib-1.2.5)
      This version will work with either a "system" libpng14 or libpng15, or with
        the embedded libpng15.  The deprecated usage of libpng png_struct members
        and unexported functions has been removed.
      Fixing "too far back" errors does not work with libpng15.
      Revised the format of the time report (all on one line so you can get
        a nice compact report by piping the output to "grep coding").

    Version 1.7.17  (built with libpng-1.5.5beta08 and zlib-1.2.5)
      Changed "#if !defined(PNG_NO_STDIO)" to "#ifdef PNG_STDIO_SUPPORTED"
        as recommended in the libpng documentation.
      Added PNG_UINT_32_NAME macro and used it to simplify chunk_type integer
        definitions.

    Version 1.7.16  (built with libpng-1.5.4 and zlib-1.2.5)
      Only report best method==0 if pngcrush cannot match the input filesize.
        Otherwise, if there is no improvement, report the first matching method.

    Version 1.7.15  (built with libpng-1.5.2rc02 and zlib-1.2.5)
      Force bit_depth to 1, 2, or 4 when -plte_len is <=2, <=4, or <=16 and
        the -bit_depth option is not present, to avoid writing invalid palette
        indexes.

    Version 1.7.14  (built with libpng-1.5.1beta08 and zlib-1.2.5)
      Removed WIN32_WCE support (libpng has dropped it already)
      Include zlib.h and define png_memcpy, etc., and revise the
        png_get_iCCP() and png_set_iCCP() calls to be able to build
        with bundled libpng-1.5.x.  Pngcrush cannot be built yet with
        a system libpng-1.5.x.
      Dropped most of pngcrush.h, that eliminates various parts of libpng.

    Version 1.7.13  (built with libpng-1.4.5 and zlib-1.2.5)

    Version 1.7.12  (built with libpng-1.4.4beta05 and zlib-1.2.5)

    Version 1.7.11  (built with libpng-1.4.2 and zlib-1.2.5)

    Version 1.7.10  (built with libpng-1.4.1 and zlib-1.2.3.9)
      Added missing "(...)" in png_get_uint_32().
      Only compile png_get_uint_32(), etc., when PNG_LIBPNG_VER < 1.2.9
      Revised help info for "-zitxt".

    Version 1.7.9  (built with libpng-1.4.1 and zlib-1.2.3.9)
      Defined TOO_FAR == 32767 in pngcrush.h (instead of in deflate.c)
      Revised the "nolib" Makefiles to remove reference to gzio.c and
        pnggccrd.c
      Imposed user limits of chunk_malloc_max=4000000 and chunk_cache_max=500.

    Version 1.7.8  (built with libpng-1.4.0 and zlib-1.2.3.5)
      Removed gzio.c

    Version 1.7.7  (built with libpng-1.4.0 and zlib-1.2.3.4)
      Updated bundled libpng to version 1.4.0.
      Check the "-plte_len n" option for out-of-range value of n.
      Changed local variable "write" to "z_write" in inffast.c (zlib-1.2.3.4)
        to avoid shadowed declaration warning.

    Version 1.7.6  (built with libpng-1.4.0rc02 and zlib-1.2.3.2)
      Change some "#if defined(X)" to "#ifdef X" according to libpng coding style.
      Added some defines to suppress pedantic warnings from libpng-1.2.41beta15
        and later.  A warning about deprecated access to png_ptr->zstream is
        otherwise unavoidable.  When building the embedded libpng, a warning
        about png_default_error() returning is also otherwise unavoidable.
      Write premultiplied alpha if output extension is .ppng and
        PNG_READ_PREMULTIPLIED_ALPHA_SUPPORTED is set (needs libpng-1.5.0).
      Check the "-m method" option for out-of-range method value.

    Version 1.7.5  (built with libpng-1.2.41beta14 and zlib-1.2.3.2)

    Version 1.7.4  (built with libpng-1.2.40rc01 and zlib-1.2.3.2)
      Use unmodified pngconf.h from libpng-1.2.41beta05 or later.

    Version 1.7.3  (built with libpng-1.2.40 and zlib-1.2.3.2)
      Print contents of text chunks after IDAT, even when the -n option
        is used.  This requires a slight modification of pngconf.h,
        when libpng-1.2.x is used.

    Version 1.7.2  (built with libpng-1.2.40 and zlib-1.2.3.2)
      Added check for "verbose" on some printf statements.

    Version 1.7.1  (built with libpng-1.2.39 and zlib-1.2.3.2)
      Revised some prototypes to eliminate "Shadowed Declaration" warnings.
      Moved warning about discarding APNG chunks to the end.
      Replaced *.tar.lzma with *.tar.xz in the distribution.

    Version 1.7.0  (built with libpng-1.2.38 and zlib-1.2.3.2)
      Save (but do not recompress) APNG chunks if the output file has the
        ".apng" extension and the color_type and bit_depth are not changed.

    Version 1.6.20 (built with libpng-1.2.38 and zlib-1.2.3.2)
      Changed local variable "write" to "wwrite" in inffast.c (zlib) to avoid
        shadowed declaration warning.

    Version 1.6.19 (built with libpng-1.2.37 and zlib-1.2.3.2)
      Added missing braces that cause an incorrect png_error() to be issued.

    Version 1.6.18 (built with libpng-1.2.37 and zlib-1.2.3.2)
      Removed extra FCLOSE(fpin) and FCLOSE(fpout) in the first Catch{} block,
        since they get removed anyway right after that (hanno boeck).
      Define PNG_NO_READ|WRITE_cHRM and PNG_NO_READ_|WRITEiCCP in pngcrush.h
        and reordered pngcrush.h

    Version 1.6.17 (built with libpng-1.2.36 and zlib-1.2.3.2)
      Defined TOO_FAR == 32767 in deflate.c (again).  The definition
        has continually been inadvertently omitted during zlib updates
        since pngcrush version 1.6.4.
      Revised handling of xcode files so at least we can get printout
        of IHDR values with "pngcrush -fix -n -v xcode.png".
      Moved ChangeLog.txt back into pngcrush.c so it does not get lost.
      Removed single quotes from the ChangeLog.

    Version 1.6.16 (built with libpng-1.2.35 and zlib-1.2.3.2)
      Added -newtimestamp and -oldtimestamp options and changed
        default condition to timestamping the output file with
        the current time (i.e., -newtimestamp is default)
      If the -oldtimestamp option is used then the output file
        has the same timestamp as the input file.
      Added CgBI chunk detection.

    Version 1.6.15 (built with libpng-1.2.35 and zlib-1.2.3.2)
      Fixes some missing typecasts on png_malloc() calls, patch from
        an anonymous reporter to the SourceForge bug tracker.
      Added -time_stamp option to change time stamping from default
        condition.

    Version 1.6.14 (built with libpng-1.2.35 and zlib-1.2.3.2)
      Avoids CVE-2009-0040.

    Version 1.6.12 (built with libpng-1.2.34 and zlib-1.2.3.2)

    Version 1.6.11 (built with libpng-1.2.33 and zlib-1.2.3.2)
      Eliminated a memory leak in libpng with writing bad tEXt chunks.

    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 not compiled
      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 CRCs 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 the libpng 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.

      "#ifdefed" 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

      "#ifdefed" 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.

      "#ifdefed" 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 was not 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.