ยง2023-04-16

  1. install
$ sudo pacman -S optipng
# optipng --help
Synopsis:
    optipng [options] files ...
Files:
    Image files of type: PNG, BMP, GIF, PNM or TIFF
Basic options:
    -?, -h, -help       show this help
    -o <level>          optimization level (0-7)                [default: 2]
    -v                  run in verbose mode / show copyright and version info
General options:
    -backup, -keep      keep a backup of the modified files
    -clobber            overwrite existing files
    -fix                enable error recovery
    -force              enforce writing of a new output file
    -preserve           preserve file attributes if possible
    -quiet, -silent     run in quiet mode
    -simulate           run in simulation mode
    -out <file>         write output file to <file>
    -dir <directory>    write output file(s) to <directory>
    -log <file>         log messages to <file>
    --                  stop option switch parsing
Optimization options:
    -f <filters>        PNG delta filters (0-5)                 [default: 0,5]
    -i <type>           PNG interlace type (0-1)
    -zc <levels>        zlib compression levels (1-9)           [default: 9]
    -zm <levels>        zlib memory levels (1-9)                [default: 8]
    -zs <strategies>    zlib compression strategies (0-3)       [default: 0-3]
    -zw <size>          zlib window size (256,512,1k,2k,4k,8k,16k,32k)
    -full               produce a full report on IDAT (might reduce speed)
    -nb                 no bit depth reduction
    -nc                 no color type reduction
    -np                 no palette reduction
    -nx                 no reductions
    -nz                 no IDAT recoding
Editing options:
    -snip               cut one image out of multi-image or animation files
    -strip <objects>    strip metadata objects (e.g. "all")
Optimization levels:
    -o0         <=>     -o1 -nx -nz                             (0 or 1 trials)
    -o1         <=>     -zc9 -zm8 -zs0 -f0                      (1 trial)
                (or...) -zc9 -zm8 -zs1 -f5                      (1 trial)
    -o2         <=>     -zc9 -zm8 -zs0-3 -f0,5                  (8 trials)
    -o3         <=>     -zc9 -zm8-9 -zs0-3 -f0,5                (16 trials)
    -o4         <=>     -zc9 -zm8 -zs0-3 -f0-5                  (24 trials)
    -o5         <=>     -zc9 -zm8-9 -zs0-3 -f0-5                (48 trials)
    -o6         <=>     -zc1-9 -zm8 -zs0-3 -f0-5                (120 trials)
    -o7         <=>     -zc1-9 -zm8-9 -zs0-3 -f0-5              (240 trials)
    -o7 -zm1-9  <=>     -zc1-9 -zm1-9 -zs0-3 -f0-5              (1080 trials)
Notes:
    The combination for -o1 is chosen heuristically.
    Exhaustive combinations such as "-o7 -zm1-9" are not generally recommended.
Examples:
    optipng file.png                                            (default speed)
    optipng -o5 file.png                                        (slow)
    optipng -o7 file.png                                        (very slow)