LinuxCommandLibrary

optipng

TLDR

Optimize PNG file

$ optipng [image.png]
copy
Optimize with maximum compression
$ optipng -o7 [image.png]
copy
Optimize multiple files
$ optipng [*.png]
copy
Preserve file timestamps
$ optipng -preserve [image.png]
copy
Simulate without modifying
$ optipng -simulate [image.png]
copy
Strip all metadata
$ optipng -strip all [image.png]
copy
Convert to PNG
$ optipng [image.bmp]
copy

SYNOPSIS

optipng [options] files...

DESCRIPTION

optipng is a PNG optimizer that reduces file size without losing quality. It recompresses the image data and removes unnecessary metadata.
The tool can also convert other formats (BMP, GIF, TIFF) to optimized PNG.

PARAMETERS

-o level

Optimization level (0-7, default 2).
-strip objects
Strip metadata (all, exif, icc, etc.).
-preserve
Preserve file attributes.
-simulate
Dry run, don't modify.
-out file
Output to different file.
-dir directory
Output directory.
-backup
Keep backup of original.
-quiet
Quiet mode.
-verbose
Verbose output.
-fix
Fix corrupt data.

CAVEATS

Higher optimization levels much slower. Lossless only - can't reduce beyond PNG limits. Some metadata may be useful. Original file modified by default.

HISTORY

OptiPNG was created by Cosmin Truta to provide optimal PNG compression. It builds on the zlib and libpng libraries, implementing various optimization strategies to minimize file size.

SEE ALSO

Copied to clipboard