README.zopflipng 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ZopfliPNG is a command line program to optimize the Portable Network Graphics
  2. (PNG) images. This version has the following features:
  3. - uses Zopfli compression for the Deflate compression,
  4. - compares several strategies for choosing scanline filter codes,
  5. - chooses a suitable color type to losslessly encode the image,
  6. - removes all chunks that are unimportant for the typical web use (metadata,
  7. text, etc...),
  8. - optionally alters the hidden colors of fully transparent pixels for more
  9. compression, and,
  10. - optionally converts 16-bit color channels to 8-bit.
  11. This is an alpha-release for testing while improvements, particularly to add
  12. palette selection, are still being made. Feedback and bug reports are welcome.
  13. Important:
  14. This PNG optimizer removes ancillary chunks (pieces of metadata) from the
  15. PNG image that normally do not affect rendering. However in special
  16. circumstances you may wish to keep some. For example for a design using
  17. custom gamma correction, keeping it may be desired. Visually check in the
  18. target renderer after using ZopfliPNG. Use --keepchunks to keep chunks, e.g.
  19. --keepchunks=gAMA,pHYs to keep gamma and DPI information. This will increase
  20. file size. The following page contains a list of ancillary PNG chunks:
  21. http://www.libpng.org/pub/png/spec/1.2/PNG-Chunks.html
  22. Build instructions:
  23. To build ZopfliPNG, compile all .c, .cc and .cpp files from src/zopfli,
  24. src/zopflipng and src/zopflipng/lodepng, except src/zopfli/zopfli_bin.c, to a
  25. single binary with C++, e.g.:
  26. g++ src/zopfli/{blocksplitter,cache,deflate,gzip_container,hash,katajainen,lz77,squeeze,tree,util,zlib_container,zopfli_lib}.c src/zopflipng/*.cc src/zopflipng/lodepng/*.cpp -O2 -W -Wall -Wextra -Wno-unused-function -ansi -pedantic -o zopflipng
  27. A makefile is provided as well, but only for linux: use "make zopflipng" with
  28. the Zopfli makefile. For other platforms, please use the build instructions
  29. above instead.
  30. The main compression algorithm in ZopfliPNG is ported from WebP lossless, but
  31. naturally cannot give as much compression gain for PNGs as it does for a more
  32. modern compression codec like WebP
  33. https://developers.google.com/speed/webp/docs/webp_lossless_bitstream_specification.
  34. Compared to libpng -- an often used PNG encoder implementation -- ZopfliPNG uses
  35. 2-3 orders of magnitude more CPU time for compression. Initial testing using a
  36. corpus of 1000 PNGs with translucency, randomly selected from the internet,
  37. gives a compression improvement of 12% compared to convert -q 95, but only 0.5%
  38. compared to pngout (from better of /f0 and /f5 runs).
  39. By releasing this software we hope to make images on the web load faster without
  40. a new image format, but the opportunities for optimization within PNG are
  41. limited. When targeting Android, Chrome, Opera, and Yandex browsers, or by using
  42. suitable plugins for other browsers, it is good to note that WebP lossless
  43. images are still 26 % smaller than images recompressed with ZopfliPNG.
  44. 2013-05-07, Lode Vandevenne and Jyrki Alakuijala