LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pngcrush

Optimize PNG files for smaller size

TLDR

Optimize PNG
$ pngcrush [input.png] [output.png]
copy
Optimize in place
$ pngcrush -ow [image.png]
copy
Remove metadata
$ pngcrush -rem alla [input.png] [output.png]
copy
Best compression
$ pngcrush -brute [input.png] [output.png]
copy
Reduce colors
$ pngcrush -reduce [input.png] [output.png]
copy
Batch optimize all PNGs in a directory
$ pngcrush -d [output_dir/] [input_dir/]*.png
copy
Set specific compression level (0-9)
$ pngcrush -l [9] [input.png] [output.png]
copy

SYNOPSIS

pngcrush [options] input [output]

DESCRIPTION

pngcrush optimizes PNG files by testing multiple compression strategies and selecting the smallest result. The optimization is completely lossless - the image data is preserved exactly while reducing file size through better compression parameters.The -brute option tries all filter and compression combinations for maximum reduction at the cost of processing time. The -rem option strips metadata chunks like text comments, timestamps, and color profiles to further reduce size.

PARAMETERS

INPUT

Input PNG file.
OUTPUT
Output PNG file.
-ow
Overwrite the input file in place.
-d DIRECTORY
Write output files to the specified directory.
-rem CHUNK
Remove a specified ancillary chunk. Use alla to remove all text chunks, or allb to remove all non-critical chunks.
-brute
Try all 148 filter/compression combinations for maximum reduction.
-reduce
Reduce color depth and bit depth where possible without data loss.
-l LEVEL
Set zlib compression level (0 = no compression, 9 = maximum).
-n
No output file; test compression without writing (useful for benchmarks).
-fix
Fix otherwise fatal conditions such as bad CRCs.

INSTALL

sudo apt install pngcrush
copy
sudo dnf install pngcrush
copy
sudo pacman -S pngcrush
copy
sudo apk add pngcrush
copy
sudo zypper install pngcrush
copy
brew install pngcrush
copy
nix profile install nixpkgs#pngcrush
copy

CAVEATS

All optimization is lossless; image data is preserved exactly. The -brute option can be very slow on large images as it tests all 148 compression strategies. The -ow flag creates a temporary file and replaces the original, so sufficient disk space is needed. Does not support animated PNGs (APNG).

HISTORY

pngcrush was created by Glenn Randers-Pehrson and has been one of the oldest and most widely used PNG optimization tools, first released in 1998.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid