OPT-PNG(1)

NAME
opt-png - losslessly optimize PNG image files

SYNOPSIS
opt-png [-h(elp)] [-f filelist] [-g(ray)] [-q(uiet)] [-p(ipe)] [-r(es) DPI] [-t(ouch)] [-T threads] file...

DESCRIPTION
opt-png losslessly optimizes PNG images by removing unused palette entries and/or optimizing the filtering algorithm. This is accomplished using a combination of the optipng, pngcrush, pngrecolor, and pngstrip utilities.

OPTIONS

-h  Print help and quit.

-f file_list
    Read the names of files to be processed from the specified file.

-g  Force output to grayscale.

-p  Read the names of files to be processed from stdin.

-q  Quiet output. No output commentary will be printed.

-r DPI
    Write the specified resolution into the pHYs chunk of the output file. Units are in pixels-per-inch. To convert from pixels-per-meter, multiply by 0.0254 (or divide by 39.37). Note that this does not change the number of pixels in the image. It only changes the assumed size of the pixels.

-t  Preserve timestamp on modified files.

-T threads
    Process up to the specified number of files in parallel. The default value is half the multi-threading capability of the CPU, i.e., half the sibling count as listed in /proc/cpuinfo.

EXAMPLES

Optimize a couple of image files:
    opt-png image001.png image002.png

Optimize all PNG images in an directory tree, utilizing half of all cores:
    find . -name "*.png"| opt-png -p

Fully utilize a quad-core system while optimizing all PNG images:
    find . -name "*.png" -print | opt-png -p -T 4

NOTES
If at all possible, make sure that pngcrush version 1.6.x or later is running on your computer. It performs substantially better than pngcrush 1.5.10 (and earlier) on black-and-white (and other low-color) images due to use of the Z_RLE zlib strategy. If opt-png appears to be malfunctioning, try running it in single-threaded mode by using the -T 1 option. This permits more meaningful error messages to be printed.

SEE ALSO
optipng(1), pngcrush(1), pngrecolor(1), pngstrip(1)

COPYRIGHT
Copyright (C) 2004-2026 by Brian Lindholm. This program is free software; you can use it, redistribute it, and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.