Linux command
optipng 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
Optimize PNG file
optipng [image.png]
Optimize with maximum compression
optipng -o7 [image.png]
Optimize multiple files
optipng [*.png]
Preserve file timestamps
optipng -preserve [image.png]
Simulate
optipng -simulate [image.png]
Strip all metadata
optipng -strip all [image.png]
Convert to PNG
optipng [image.bmp]
说明
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.
参数
- -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.
- -force
- Enforce writing of a new output file.
- -snip
- Cut one image out of multi-image or animation files.
- -nb
- Do not apply bit depth reduction.
- -nc
- Do not apply color type reduction.
- -np
- Do not apply palette reduction.
- -nx
- Do not apply any lossless image reduction.
- -nz
- Do not recode IDAT datastreams.
- -i _type_
- Interlace type (0=non-interlaced, 1=Adam7).
- -f _filters_
- PNG delta filters (0-5).
- -zc _levels_
- Zlib compression levels (1-9).
- -zs _strategies_
- Zlib compression strategies (0-3).
- -zm _levels_
- Zlib memory levels (1-9).
- -zw _size_
- Zlib window size (256, 512, 1k, 2k, 4k, 8k, 16k, 32k).
FAQ
What is the optipng command used for?
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.
How do I run a basic optipng example?
Run `optipng [image.png]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -o _level_ do in optipng?
Optimization level (0-7, default 2).