Crunch is a tool for lossy PNG image file optimization. It combines selective bit depth, color type, and color palette reduction with zopfli DEFLATE compression algorithm encoding using the pngquant and zopflipng PNG optimization tools. This approach leads to a significant file size gain relative to lossless approaches at the expense of a relatively modest decrease in image quality (seeexample imagesbelow).
Continuous benchmark testingis available in our GitHub Actions CI. Please see the benchmarks directory of this repository for details about the benchmarking approach and instructions on how to execute benchmarks locally on the reference images distributed in this repository or with your own image files.
Crunch PNG image optimization is available through the following applications that are distributed in this repository:
crunch
- a *nix command line executable that can be used on macOS, Linux, and Windows POSIX application deployment environments such as Cygwin or the Windows subsystem for Linux- Crunch GUI- a native macOS drag and drop GUI tool
- Crunch Image(s)service - a macOS right-click menu service for PNG images selected in the Finder
Installation and usage documentation links for each of the Crunch applications are available below.
Thecrunch
command line executable can be installed withmake
or manually. Please see theInstall documentation.
Enter paths to your PNG image files as arguments to thecrunch
executable. Please see theUsage documentation.
The Crunch native macOS GUI application can be installed with Homebrew or the dmg installer that can be downloaded from therepository releases.Please see theInstall documentation.
Drag and drop one or more images on the application window to process your PNG files. Please see theUsage documentation.
The macOS right-click menu service "Crunch Image(s)" can be installed withmake
or manually by drag and drop in the macOS Finder. Please see theInstall documentation.
Select one or more PNG images in the Finder, right-click, and select theServices > Crunch Image(s)
menu item to process your files. Please see theUsage documentation.
The following examples demonstrate the benefits and disadvantages of the current iteration of Crunch's aggressive space saving optimization strategy. The optimized image files are updated at every Crunch release. In many cases, the PNG optimization decreases file size with an imperceptible impact on image quality. In some cases, degradation of image quality is visible. Visual confirmation of image quality is highly recommended with lossy optimization tools in production settings.
- Original Size: 583,398 bytes
- Optimized Size: 196,085 bytes
- DSSIM similarity score: 0.001383
- Percent original size: 33.61%
- Original Size: 138,272
- Optimized Size: 66,593
- DSSIM similarity score: 0.000920
- Percent original size: 48.16%
- Original Size: 196,794 bytes
- Optimized Size: 77,965 bytes
- DSSIM similarity score: 0.002923
- Percent original size: 39.62%
- Original Size: 197,193 bytes
- Optimized Size: 67,596 bytes
- DSSIM similarity score: 0.003047
- Percent original size: 34.28%
- Original Size: 249,251 bytes
- Optimized Size: 67,135 bytes
- DSSIM similarity score: 0.002450
- Percent original size: 26.93%
- Original Size: 440,126 bytes
- Optimized Size: 196,962 bytes
- DSSIM similarity score: 0.001013
- Percent original size: 44.75%
All images above were obtained fromPixabayand are dedicated to the public domain under theCC0 Public Domain Dedication.
DSSIM testing was performed with v2.10.0 of thekornelski/dssim tool.
Have you identified a problem? Pleasecreate a new issue reporton the Github issue tracker so that we can address it.
Crunch is licensed under theMIT license.
pngquant is licensed under theGnu General Public License, version 3.The pngquant source code is availablehere.
zopflipng is licensed under theApache License, Version 2.0.The upstream zopflipng source code is availablehere.The source for the modified zopflipng fork that is used in this project is availablehere.
See theLICENSE.mddocument for details and additional licensing information for this project.
Contributions to the project are warmly welcomed. Please suggest enhancements as new issue reports on this repository. Source contributors should fork the git repository and submit changes as a Github pull request.
Crunch is a simple tool that makes excellent, free, open source software built by others more accessible. The hard work on the optimization engines that run Crunch has been performed by:
- Lode Vandevenne, Jyrki Alakuijala, and thezopfli project contributors
- Kornel Lesiński and thepngquant project contributors
The fantastic macOS GUI animations were designed byGary Jacobs.