optipng 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

optipng 命令安装:


-bash/zsh: optipng command not not found

# Windows (WSL2)
sudo apt-get update sudo apt-get install optipng

# Debian
apt-get install optipng

# Ubuntu
apt-get install optipng

# Alpine
apk add optipng

# Arch Linux
pacman -S optipng

# Kali Linux
apt-get install optipng

# CentOS
yum install optipng

# Fedora
dnf install optipng

# OS X
brew install optipng

# Raspbian
apt-get install optipng

# Docker
docker run cmd.cat/optipng optipng

optipng 命令补充说明:


optiPNG 是一款 PNG 优化器,它可以在不丢失任何信息的前提下,将图像文件重新压缩到更小的尺寸。该程序还可以将外部格式(BMP、GIF、PNM 和 TIFF)转换为优化的 PNG 格式,并执行 PNG 完整性检查和校正。

如果您想了解 PNG 优化的工作原理,或了解其他类似工具,请参阅 PNG Tech 文章《PNG 优化指南》

optipng 命令语法:


optipng [-? | -h | -help]
optipng [options...] files...

optipng 命令选项:


-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).

optipng 命令实例:


optipng 使用默认设置压缩 PNG 文件:

optipng path/to/file.png

optipng 使用最佳压缩方式 -o7 压缩 PNG 文件:

optipng -o7 path/to/file.png

optipng 使用最快的压缩方式压缩 PNG 文件:

optipng -o0 path/to/file.png

optipng 压缩PNG图像并添加隔行扫描:

optipng -i 1 path/to/file.png

optipng 压缩 PNG 图片并保留所有元数据(包括文件时间戳):

optipng -preserve path/to/file.png

optipng 压缩 PNG 图片并移除所有元数据:

optipng -strip all path/to/file.png

optipng 命令扩展阅读:


 

CommandNotFound ⚡️ 坑否 - 其他频道扩展阅读:




optipng 命令评论