Home

Awesome

<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/header-img-crunch.png" alt="Crunch PNG file optimization" width="250"><img src="https://github.com/chrissimpkins/Crunch/raw/master/img/slowdots.gif" alt="Crunch PNG file optimization" width="100"> <img src="https://github.com/chrissimpkins/Crunch/raw/master/img/header-arrow-crunch.png" alt="Crunch PNG file optimization">

GitHub release Linux Python CI macOS Python CI Lints Benchmarks

About

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 (see example images below).

Continuous benchmark testing is 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:

Installation and Usage

Installation and usage documentation links for each of the Crunch applications are available below.

crunch Command Line Executable

The crunch command line executable can be installed with make or manually. Please see the Install documentation.

Enter paths to your PNG image files as arguments to the crunch executable. Please see the Usage documentation.

Crunch macOS GUI Application

The Crunch native macOS GUI application can be installed with Homebrew or the dmg installer that can be downloaded from the repository releases. Please see the Install documentation.

Drag and drop one or more images on the application window to process your PNG files. Please see the Usage documentation.

Crunch Image(s) macOS Right-Click Menu Service

The macOS right-click menu service "Crunch Image(s)" can be installed with make or manually by drag and drop in the macOS Finder. Please see the Install documentation.

Select one or more PNG images in the Finder, right-click, and select the Services > Crunch Image(s) menu item to process your files. Please see the Usage documentation.

Contents

Examples

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.

Photography Examples

Cat Image

Original
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/cat-1285634_640.png" alt="cat example pre optimization">
Optimized
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/cat-1285634_640-crunch.png" alt="cat example post optimization">

Sun's Rays

Original
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/suns-rays-478249_640.png" alt="sun rays example pre optimization">
Optimized
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/suns-rays-478249_640-crunch.png" alt="sun rays example pre optimization">

Prairie Image

Original
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/prairie-679014_640.png" alt="prarie example pre optimization">
Optimized
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/prairie-679014_640-crunch.png" alt="prarie example post optimization">

Illustration Examples

Robot Image

Original
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/robot-1214536_640.png" alt="robot example pre optimization">
Optimized
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/robot-1214536_640-crunch.png" alt="robot example post optimization">

Color Circle Image

Original
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/colors-157474_640.png" alt="colors example pre optimization">
Optimized
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/colors-157474_640-crunch.png" alt="colors example post optimization">

Flowers Image

Original
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/flowers-67839_640.png" alt="748">
Optimized
<img src="https://github.com/chrissimpkins/Crunch/raw/master/img/flowers-67839_640-crunch.png" alt="748">

All images above were obtained from Pixabay and are dedicated to the public domain under the CC0 Public Domain Dedication.

DSSIM testing was performed with v2.10.0 of the kornelski/dssim tool.

Issue Reporting

Have you identified a problem? Please create a new issue report on the Github issue tracker so that we can address it.

Licenses

Crunch is licensed under the MIT license.

Embedded Software

pngquant is licensed under the Gnu General Public License, version 3. The pngquant source code is available here.

zopflipng is licensed under the Apache License, Version 2.0. The upstream zopflipng source code is available here. The source for the modified zopflipng fork that is used in this project is available here.

See the LICENSE.md document for details and additional licensing information for this project.

Contributing

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.

Acknowledgments

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:

The fantastic macOS GUI animations were designed by Gary Jacobs.