← 返回命令列表

Linux command

oxipng 命令

网络

复制后可按需替换文件名、目录或参数。

常用示例

Optimize PNG file

oxipng [image.png]

Optimize with maximum compression

oxipng -o max [image.png]

Optimize and write to a different file

oxipng --out [output.png] [input.png]

Optimize all PNGs in directory

oxipng [*.png]

Strip all metadata

oxipng --strip all [image.png]

Use multiple threads

oxipng -t [4] [image.png]

Reduce to 8-bit palette if possible

oxipng --reduce [image.png]

Dry run

oxipng --pretend [image.png]

说明

oxipng is a multithreaded PNG optimization tool written in Rust. It reduces PNG file sizes through lossless recompression without affecting image quality. Optimization levels (0-6) control the trade-off between compression and speed. Level 2 is default, providing good compression quickly. Level 6 and "max" try more strategies for maximum compression but take longer. The tool tries different PNG filter strategies and compression parameters to find the smallest output. Metadata stripping further reduces size - "safe" removes non-essential chunks, "all" removes everything except critical image data. Bit depth reduction automatically converts 16-bit to 8-bit or RGBA to palette when possible without quality loss. This can significantly reduce file sizes for suitable images. Zopfli mode uses a more exhaustive compression algorithm for ~5% better compression at the cost of much longer processing time. This is useful for images that will be served repeatedly.

参数

-o, --opt _LEVEL_
Optimization level (0-6, max).
-s, --strip _MODE_
Strip metadata: none, safe (non-rendering metadata), all (everything non-critical). -s alone is shorthand for --strip safe.
-a, --alpha
Additional alpha optimizations.
-t, --threads _NUM_
Number of threads.
--out _DIR_
Output directory.
--dir _DIR_
Recursively process directory.
-r, --recursive
Process directories recursively.
--reduce
Attempt bit depth reduction.
--interlace _MODE_
Interlacing: 0 (none), 1 (Adam7), keep.
--pretend
Dry run, show savings without writing.
-b, --backup
Keep backup of original file.
-f _NUM_, --filters _NUM_
Filter strategies to try (0=None, 1=Sub, 2=Up, 3=Average, 4=Paeth, 5=MinSum, 6=Entropy, 7=Bigrams, 8=BigEnt, 9=Brute). Supports comma-separated lists or ranges (e.g., 0-5).
-Z, --zopfli
Use Zopfli for better compression (much slower).
--timeout _seconds_
Maximum time to spend optimizing a single file.
--check
Verify output integrity.
-q, --quiet
Quiet mode.
-v, --verbose
Verbose output.

FAQ

What is the oxipng command used for?

oxipng is a multithreaded PNG optimization tool written in Rust. It reduces PNG file sizes through lossless recompression without affecting image quality. Optimization levels (0-6) control the trade-off between compression and speed. Level 2 is default, providing good compression quickly. Level 6 and "max" try more strategies for maximum compression but take longer. The tool tries different PNG filter strategies and compression parameters to find the smallest output. Metadata stripping further reduces size - "safe" removes non-essential chunks, "all" removes everything except critical image data. Bit depth reduction automatically converts 16-bit to 8-bit or RGBA to palette when possible without quality loss. This can significantly reduce file sizes for suitable images. Zopfli mode uses a more exhaustive compression algorithm for ~5% better compression at the cost of much longer processing time. This is useful for images that will be served repeatedly.

How do I run a basic oxipng example?

Run `oxipng [image.png]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -o, --opt _LEVEL_ do in oxipng?

Optimization level (0-6, max).