What if png but lossy? Even though I work on apps that regularly package megabytes of JavaScript or other assets, my personal ethical code still does not allow me to distribute images that are not optimally compressed. There is a great tool, pngquant, that reduces the number of distinct colors in a PNG (posterization) so that it compresses better. But it’s hard to use a CLI tool to choose the right level of lossy compression for our precious PNGs. You have to run the tool, manually inspect the output, tweak the settings, run it again, and so on. It would be nice if we had a UI to help us experiment. ImageAlpha was the GUI frontend for pngquant, but it no longer runs on modern versions of macOS.
pngchomp attempts to fill the hole that ImageAlpha left behind. It is a simple SwiftUI wrapper for pngquant and oxipng that lets you examine your image with different levels of posterization.
You can download the latest release from the Releases page, or install it with as a cask withHomebrew:
brew tap jonshea/taps
brew install pngchompspace– Toggle between the original image and the compressed imagec– Toggle between the original image and comparison moded– Toggle dithering on/offb– Cycle between background color options⌘+s– Save the currently selected image↑– Switch to the next higher‑quality setting↓– Switch to the next lower‑quality setting
- macOS 15.0 (Sequoia) or later
- Mac with Apple Silicon (M1/M2/M3)
I ended up using SwiftUI APIs that are only available on macOS 15.0+, and only discovered that after I had already mostly finished the app. I’m sure we could go back and refactor things to have more backward compatibility, but I am not compelled to do that before anyone is even using the app. Likewise, we only build and package pngquant and oxipng for Apple Silicon.
As part of the build process, we check out the source code for pngquant and oxipng, build them, and copy the binaries into pngchomp’s executables directory (Contents/MacOS). In the Xcode project, we have “External Build System” targets for pngquant and oxipng, each of which simply runs the corresponding script in build-support/. The script clones the source code for the tool, checks out a hard‑coded release SHA, and calls cargo to do the build. We expect that cargo is somehow on your path, but we also add /opt/homebrew/bin to the path so that we can use the brew‑installed version of cargo. Finally, in the pngchomp target there is a “Copy Files” step that handles copying the tool binaries into the app bundle.
I would guess there is a cleaner way to manage all of this, maybe cargo-xcode, but what we have seems to work for now.
pngchomp is inspired by ImageAlpha and built on top of pngquant, both of which are excellent tools created or enhanced by Kornel Lesiński. pngchomp also uses oxipng for lossless optimization of PNGs.
