⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pngcrush.c

📁 It was built with libpng version 1.2.35, and is running with libpng version 1.2.35
💻 C
📖 第 1 页 / 共 5 页
字号:

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 libpngs 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.

#endif /* end of changelog */

#include "png.h"

/* internal libpng macros */


#ifdef PNG_LIBPNG_VER
#define PNGCRUSH_LIBPNG_VER PNG_LIBPNG_VER
#else
/* 
 * This must agree with PNG_LIBPNG_VER; you have to define it manually
 * here if you are using libpng-1.0.6h or earlier
 */
#define PNGCRUSH_LIBPNG_VER 10007
#endif

/* Changed in version 0.99 */
#if PNGCRUSH_LIBPNG_VER < 99
#undef PNG_CONST
#ifndef PNG_NO_CONST
#  define PNG_CONST const
#else
#  define PNG_CONST
#endif
#endif

#define PNG_IDAT const png_byte png_IDAT[5] = { 73,  68,  65,  84, '\0'}
#define PNG_IHDR const png_byte png_IHDR[5] = { 73,  72,  68,  82, '\0'}
#define PNG_dSIG const png_byte png_dSIG[5] = {100,  83,  73,  71, '\0'}
#define PNG_iCCP const png_byte png_iCCP[5] = {105,  67,  67,  80, '\0'}
#define PNG_IEND const png_byte png_IEND[5] = { 73,  69,  78,  68, '\0'}

/* GRR 20050220:  added these, which apparently aren't defined anywhere else */
#ifndef PNG_UINT_IHDR
#  define PNG_UINT_IHDR (((png_uint_32)  73<<24) | \
                         ((png_uint_32)  72<<16) | \
                         ((png_uint_32)  68<< 8) | \
                         ((png_uint_32)  82    ))
#endif

#ifndef PNG_UINT_IDAT
#  define PNG_UINT_IDAT (((png_uint_32)  73<<24) | \
                         ((png_uint_32)  68<<16) | \
                         ((png_uint_32)  65<< 8) | \
                         ((png_uint_32)  84    ))
#endif

#ifndef PNG_UINT_IEND
#  define PNG_UINT_IEND (((png_uint_32)  73<<24) | \
                         ((png_uint_32)  69<<16) | \
                         ((png_uint_32)  78<< 8) | \
                         ((png_uint_32)  68    ))
#endif

#ifndef PNG_UINT_PLTE
#  define PNG_UINT_PLTE (((png_uint_32)  80<<24) | \
                         ((png_uint_32)  76<<16) | \
                         ((png_uint_32)  84<< 8) | \
                         ((png_uint_32)  69    ))
#endif

#ifndef PNG_UINT_bKGD
#  define PNG_UINT_bKGD (((png_uint_32)  98<<24) | \
                         ((png_uint_32)  75<<16) | \
                         ((png_uint_32)  71<< 8) | \
                         ((png_uint_32)  68    ))
#endif

/* glennrp added CgBI at pngcrush-1.6.16 */
#ifndef PNG_UINT_CgBI
#  define PNG_UINT_CgBI (((png_uint_32)  67<<24) | \
                         ((png_uint_32) 103<<16) | \
                         ((png_uint_32)  66<< 8) | \
                         ((png_uint_32)  73    ))
#endif

#ifndef PNG_UINT_cHRM
#  define PNG_UINT_cHRM (((png_uint_32)  99<<24) | \
                         ((png_uint_32)  72<<16) | \
                         ((png_uint_32)  82<< 8) | \
                         ((png_uint_32)  77    ))
#endif

#ifndef PNG_UINT_dSIG
#  define PNG_UINT_dSIG (((png_uint_32) 100<<24) | \
                         ((png_uint_32)  83<<16) | \
                         ((png_uint_32)  73<< 8) | \
                         ((png_uint_32)  71    ))
#endif

#ifndef PNG_UINT_gAMA
#  define PNG_UINT_gAMA (((png_uint_32) 103<<24) | \
                         ((png_uint_32)  65<<16) | \
                         ((png_uint_32)  77<< 8) | \
                         ((png_uint_32)  65    ))
#endif

#ifndef PNG_UINT_hIST
#  define PNG_UINT_hIST (((png_uint_32) 104<<24) | \
                         ((png_uint_32)  73<<16) | \
                         ((png_uint_32)  83<< 8) | \
                         ((png_uint_32)  84    ))
#endif

#ifndef PNG_UINT_iCCP
#  define PNG_UINT_iCCP (((png_uint_32) 105<<24) | \
                         ((png_uint_32)  67<<16) | \
                         ((png_uint_32)  67<< 8) | \
                         ((png_uint_32)  80    ))
#endif

#ifndef PNG_UINT_iTXt
#  define PNG_UINT_iTXt (((png_uint_32) 105<<24) | \
                         ((png_uint_32)  84<<16) | \
                         ((png_uint_32)  88<< 8) | \
                         ((png_uint_32) 116    ))
#endif

#ifndef PNG_UINT_oFFs
#  define PNG_UINT_oFFs (((png_uint_32) 111<<24) | \
                         ((png_uint_32)  70<<16) | \
                         ((png_uint_32)  70<< 8) | \
                         ((png_uint_32) 115    ))
#endif

#ifndef PNG_UINT_pCAL
#  define PNG_UINT_pCAL (((png_uint_32) 112<<24) | \
                         ((png_uint_32)  67<<16) | \
                         ((png_uint_32)  65<< 8) | \
                         ((png_uint_32)  76    ))
#endif

#ifndef PNG_UINT_pHYs
#  define PNG_UINT_pHYs (((png_uint_32) 112<<24) | \
                         ((png_uint_32)  72<<16) | \
                         ((png_uint_32)  89<< 8) | \
                         ((png_uint_32) 115    ))
#endif

#ifndef PNG_UINT_sBIT
#  define PNG_UINT_sBIT (((png_uint_32) 115<<24) | \
                         ((png_uint_32)  66<<16) | \
                         ((png_uint_32)  73<< 8) | \
                         ((png_uint_32)  84    ))
#endif

#ifndef PNG_UINT_sCAL
#  define PNG_UINT_sCAL (((png_uint_32) 115<<24) | \
                         ((png_uint_32)  67<<16) | \
                         ((png_uint_32)  65<< 8) | \
                         ((png_uint_32)  76    ))
#endif

#ifndef PNG_UINT_sPLT
#  define PNG_UINT_sPLT (((png_uint_32) 115<<24) | \
                         ((png_uint_32)  80<<16) | \
                         ((png_uint_32)  76<< 8) | \
                         ((png_uint_32)  84    ))
#endif

#ifndef PNG_UINT_sTER
#  define PNG_UINT_sTER (((png_uint_32) 115<<24) | \
                         ((png_uint_32)  84<<16) | \
                         ((png_uint_32)  69<< 8) | \
                         ((png_uint_32)  82    ))
#endif

#ifndef PNG_UINT_sRGB
#  define PNG_UINT_sRGB (((png_uint_32) 115<<24) | \
                         ((png_uint_32)  82<<16) | \
                         ((png_uint_32)  71<< 8) | \
                         ((png_uint_32)  66    ))
#endif

#ifndef PNG_UINT_tEXt
#  define PNG_UINT_tEXt (((png_uint_32) 116<<24) | \
                         ((png_uint_32)  69<<16) | \
                         ((png_uint_32)  88<< 8) | \
                         ((png_uint_32) 116    ))
#endif

#ifndef PNG_UINT_tIME
#  define PNG_UINT_tIME (((png_uint_32) 116<<24) | \
                         ((png_uint_32)  73<<16) | \
                         ((png_uint_32)  77<< 8) | \
                         ((png_uint_32)  69    ))
#endif

#ifndef PNG_UINT_tRNS
#  define PNG_UINT_tRNS (((png_uint_32) 116<<24) | \
                         ((png_uint_32)  82<<16) | \
                         ((png_uint_32)  78<< 8) | \
                         ((png_uint_32)  83    ))
#endif

#ifndef PNG_UINT_zTXt
#  define PNG_UINT_zTXt (((png_uint_32) 122<<24) | \
                         ((png_uint_32)  84<<16) | \
                         ((png_uint_32)  88<< 8) | \
                         ((png_uint_32) 116    ))
#endif

#define PNG_FLAG_CRC_ANCILLARY_USE        0x0100

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -