Command line, static executable to reduce file size of PNG images with minimal quality loss, written in Zig language. Perfect for forum sites that impose upload size limitations.
- zig-clap
- lodepng (C variant)
- libimagequant (2.x branch)
- Clone the repository to your machine.
git clone https://github.com/GrainyTV/PngCompressor.git
- Navigate to the repository.
cd PngCompressor
- Compile the project by specifying the target CPU architecture and operating system. For example on a 64-bit Linux system you would use the following:
zig build -Dtarget=x86_64-linux-musl -Doptimize=ReleaseFast
To compress a single PNG file:
./PngCompressor -i input.png -o output.png
To compress all PNG files in a folder, in-place:
./PngCompressor -i ./my_folder --force
Note that you can also use absolute paths instead of relative ones if you prefer those.
The images below demonstrate the quality of image compression achieved by PngCompressor. The left image shows the original, and the right image shows the compressed version. Not really noticeable unless you look very closely.
I welcome contributions from anyone. If you have any observations, bug reports, or suggestions for improvements, please create issues or pull requests on this repository.
PngCompressor is released under the MIT License. You are free to use, modify, and distribute the code in accordance with the terms of the license. See the LICENSE file for more details.





