Skip to content
Branch: master
Find file Copy path
Find file Copy path
3 contributors

Users who have contributed to this file

@kornelski @naoliv @jaalto
130 lines (129 sloc) 3.59 KB
.Dd 2013-02-25
.Dt pngquant 1
.Nm pngquant
.Nd PNG converter and lossy image compressor
.Aq options
.Op ncolors
.Pa file
.Op Ar
.Aq options
.Op ncolors
.Cm < Ns Pa file
.Cm > Ns Pa file
converts 32-bit RGBA PNGs to 8-bit (or smaller) RGBA-palette PNGs, optionally using Floyd-Steinberg dithering.
The output filename is the same as the input name except that it ends in
.Ql -fs8.png
.Ql -or8.png
(unless the input is stdin, in which case the quantized image will go to stdout).
The default behavior if the output file exists is to skip the conversion; use
.Fl Fl force
to overwrite.
.Bl -tag -width -indent
.It Fl o Ar out.png , Fl Fl output Ar out.png
Writes converted file to the given path. When this option is used only single input file is allowed.
.It Fl Fl ext Ar new.png
File extension (suffix) to use for output files instead of the default
.Ql -fs8.png
.Ql -or8.png .
.It Fl f , Fl Fl force
Overwrite existing output files.
.Fl Fl ext
.Ar .png
.Fl Fl force
can be used to convert files in place (which is unsafe).
.It Fl Fl nofs , Fl Fl ordered
Disable Floyd-Steinberg dithering.
.It Fl Fl floyd Op Ar =N
Set dithering level using fractional number between
.Cm 0
(none) and
.Cm 1
(full, the default).
.It Fl s Ar N , Fl Fl speed Ar N
.Cm 1
(brute-force) to
.Cm 11
(fastest). The default is
.Cm 3 .
.Cm 10
has 5% lower quality, but is about 8 times faster than the default. Speed 11 disables dithering and lowers compression level.
.It Fl Q Ar min-max , Fl Fl quality Ar min-max
.Va min
.Va max
are numbers in range
.Cm 0
(worst) to
.Cm 100
(perfect), similar to JPEG.
will use the least amount of colors required to meet or exceed the
.Va max
quality. If conversion results in quality below the
.Va min
quality the image won't be saved (or if outputting to stdin, 24-bit original will be output) and pngquant will exit with status code
.Er 99 .
.It Fl Fl skip-if-larger
If conversion results in a file larger than the original, the image won't be saved and pngquant will exit with status code
.Er 98 .
Additionally, file size gain must be greater than the amount of quality lost. If quality drops by 50%, it will expect 50% file size reduction to consider it worthwhile.
.It Fl Fl posterize Ar bits
Truncate number of least significant bits of color (per channel). Use this when image will be output on low-depth displays (e.g. 16-bit RGB).
will make almost-opaque pixels fully opaque and will reduce amount of semi-transparent colors. When this option is enabled the default filename suffix is
.Ql -ie-fs8.png
.Ql -ie-or8.png .
.It Fl Fl strip
Remove optional chunks (metadata) from PNG files.
.It Fl Fl transbug
Workaround for readers that expect fully transparent color to be the last entry in the palette.
.It Fl v , Fl Fl verbose
Enable verbose messages showing progress and information about input/output. Opposite is
.Fl Fl quiet .
Errors are output to
.Pa stderr
regardless of this option.
.It Fl V , Fl Fl version
Display version on
.Pa stdout
and exit.
.It Fl h , Fl Fl help
Display help and exit.
Creating a new image with the number of colors reduced to 64:
.Bd -ragged -offset indent
.Cm 64 image.png
The resulting image will have 64 colors and will be saved as
.Pa image-fs8.png .
Overwriting image in-place if it can be reduced without too much quality loss:
.Bd -ragged -offset indent
.Cm -f --ext .png --quality 70-95 image.png
is developed by Kornel Lesinski
.Aq Mt
based on code by Greg Roelofs
.Aq Mt .
.Lk "pngquant homepage" .
You can’t perform that action at this time.