PNGCRUSH(1)

NAME
pngcrush - optimizes PNG (Portable Network Graphics) files

DESCRIPTION
Pngcrush is an optimizer for PNG (Portable Network Graphics) files. Its main purpose is to reduce the size of the PNG IDAT data stream by trying various compression levels and PNG filter methods. It also can be used to remove unwanted ancillary chunks, or to add certain chunks including gAMA, tRNS, and textual chunks.

USAGE
pngcrush [options except for -e -d] infile.png outfile.png

pngcrush -e ext [other options] file.png ...

pngcrush -d dir/ [other options] file.png ...

pngcrush -ow [other options] file.png [tempfile.png]

pngcrush -n -v file.png ...

OPTIONS
options (Note: any option can be spelled out for clarity, e.g.,

    "pngcrush -dir New -method 7 -remove bkgd *.png" is the same as "pngcrush -d New/ -m 7 -rem bkgd *.png"):

-bail (bail out of trial when size exceeds best size found

    Default is to bail out and simply report that the filesize for the trial would be greater than the best filesize achieved so far. Use the "-nobail" option to prevent that.

-blacken (zero samples underlying fully-transparent pixels)

    Changing the color samples to zero can improve the compressibility. Since this is a lossy operation, blackening is off by default.

-brute (use brute-force: try 176 different methods)

    Very time-consuming and generally not worthwhile. You can restrict this option to certain filter types, compression levels, or strategies by following it with "-f filter", "-l level", or "-z strategy".

-c color_type of output file [0, 2, 4, or 6]

Color type for the output file.
    Future versions

    will also allow color_type 3, if there are 256 or fewer colors present in the input file. Color types 4 and 6 are padded with an opaque alpha channel if the input file does not have alpha information. You can use 0 or 4 to convert color to grayscale. Use 0 or 2 to delete an unwanted alpha channel. Default is to use same color type as the input file.

-check (check CRC and ADLER32 checksums)

    Use "-nocheck" (default) to skip checking them

-d directory_name/ (where output files will go)

    If a directory name is given, then the output files are placed in it, with the same filenames as those of the original files. For example, you would type 'pngcrush -directory CRUSHED/ *.png' to get *.png => CRUSHED/*.png. The trailing slash is optional, but if pngcrush appends the wrong kind of slash or backslash, please include the correct one at the end of the directory_name, as shown.

-e extension
    (used for creating output filename)

    e.g., -ext .new means *.png => *.new and -e _pc.png means *.png => *_pc.png

-f user_filter [0-5] for specified method

    filter to use with the method specified in the preceding '-m method' or '-brute_force' argument. 0: none; 1-4: use specified filter; 5: adaptive.

-fix (salvage PNG with otherwise fatal conditions)

    Fixes bad CRCs, bad adaptive filter bytes, or bad CMF bytes in the IDAT chunk that cause the "Too far back" error

-force (write output even if IDAT is larger)

-g gamma (float or fixed*100000, e.g., 0.45455 or 45455)

    Value to insert in gAMA chunk, only if the input file has no gAMA chunk. To replace an existing gAMA chunk, use the '-replace_gamma' option.

-huffman (use only zlib strategy 2, Huffman-only)

    Fast, but almost never very effective except for certain rare image types.

-iccp length "Profile Name" iccp_file

    file with ICC profile to insert in an iCCP chunk.

-itxt b[efore_IDAT]|a[fter_IDAT] "keyword" "language_code" "translated_keyword" "text"

    Uncompressed iTXt chunk to insert (see -text).

-keep chunk_name

    keep named chunk even when pngcrush makes changes to the PNG datastream that cause it to become invalid. Currently only dSIG is recognized as a chunk to be kept.

-l zlib_compression_level [0-9] for specified method

    zlib compression level to use with method specified with the preceding '-m method' or '-brute_force' argument.

-loco ("loco crush" truecolor PNGs)

    Make the file more compressible by performing a lossless, reversible, color transformation. The resulting file is a MNG, not a PNG, and should be given the ".mng" file extension. The "loco" option has no effect on grayscale or indexed-color PNG files.

-m method [1 through 177]

pngcrush method to try.
    Can be repeated as in

    '-m 1 -m 4 -m 7'. This can be useful if pngcrush runs out of memory when it tries methods 2, 3, 5, 6, 8, 9, or 10 which use filtering and are memoryintensive. Methods 1, 4, and 7 use no filtering; methods 11 and up use a specified filter, compression level, and strategy.

-max maximum_IDAT_size [default 524288L]

-mng (write a new MNG, do not crush embedded PNGs)

-n (no save; doesn't do compression or write output PNG)

    Useful in conjunction with -v option to get info.

-new (Use new default settings (-reduce))

-newtimestamp (Reset file modification time [default])

-nobail (do not bail out early from trial -- see "-bail")

    Use this if you want to get a report of the exact filesize achieved by each trial.

-nocheck (do not check CRC and ADLER32 checksums)

    Use "-check" to check them

-nofilecheck (do not check for infile.png == outfile.png)

To avoid false hits from MSVC-compiled code.
    Note

    that if you use this option, you are responsible for ensuring that the input file is not the output file.

-noforce (default; do not write output when IDAT is larger)

-nolimits (turns off limits on width, height, cache, malloc)

    Instead, the user limits are inherited from libpng.

-noreduce (turns off all "-reduce" operations)

-noreduce_palette (turns off "-reduce_palette" operation)

-old (Use old default settings (no -reduce))

-oldtimestamp (Do not reset file modification time)

-ow (Overwrite)

Overwrite the input file.
    The input file is removed

    and the temporary file (default "pngout.png") is renamed to the input file after recompression and therefore they must reside on the same filesystem.

    CAUTION: If you are running multiple instances of pngcrush in parallel, you must specify a different temporary filename for each instance, to avoid collisions.

-q (quiet) suppresses console output except for warnings

    and summary of results.

-reduce (do lossless color-type or bit-depth reduction)

(if possible).
    Also reduces palette length if

possible.
    Currently only attempts to reduce the

bit depth from 16 to 8.
    Reduces all-gray RGB

or RGBA image to gray or gray-alpha.
    Reduces

    all-opaque RGBA or GA image to RGB or grayscale. Since pngcrush version 1.8.0, -reduce is on by default, and you can disable it with -noreduce.

-rem chunkname (or "alla" or "allb")

    Name of an ancillary chunk or optional PLTE to be removed. Be careful with this. Don't use this feature to remove transparency, gamma, copyright, or other valuable information. To remove several different chunks, repeat: -rem tEXt -rem pHYs. Known chunks (those in the PNG 1.1 spec or extensions document) can be named with all lower-case letters, so "-rem bkgd" is equivalent to "-rem bKGD". But note: "-rem text" removes all forms of text chunks; Exact case is required to remove unknown chunks. To do surgery with a chain-saw, "-rem alla" removes all known ancillary chunks except for tRNS, and "-rem allb" removes all but tRNS and gAMA.

-replace_gamma gamma (float or fixed*100000) even if it is present.

-res resolution in dpi

    Write a pHYs chunk with the given resolution in dpi written as pixels per meter in x and y directions.

-rle (use only zlib strategy 3, RLE-only)

    A relatively fast subset of the "-brute" methods, generally more effective than "-huffman" on PNG, images (and quite effective on black-and-white images) but not necessarily worth the bother otherwise.

-s (silent) suppresses console output including warnings

    benchmark timing, and summary of results. (Use "-warn" to show only warnings

-save (keep all copy-unsafe PNG chunks)

    Save otherwise unknown ancillary chunks that would be considered copy-unsafe. This option makes chunks 'known' to pngcrush, so they can be copied. It also causes the dSIG chunk to be saved, even when it becomes invalid due to datastream changes. This option does not affect APNG chunks. These chunks (acTL, fcTL, and fdAT) will be saved only if the output file has the ".apng" extension and the color_type and bit_depth are not changed.

-speed Avoid the AVG and PAETH filters, for decoding speed

    Useful for compressing PNG files that are expected to be cached or otherwise to exist on the computer where they will be used rather than being downloaded, so filesize is therefore less important than CPU time expended in defiltering.

-srgb [0, 1, 2, or 3]

    Value of 'rendering intent' for sRGB chunk.

-ster [0 or 1]

    Value of 'stereo mode' for sTER chunk. 0: cross-fused; 1: divergent-fused

-text b[efore_IDAT]|a[fter_IDAT] "keyword" "text"

tEXt chunk to insert.
    keyword < 80 chars,

    text < 2048 chars. For now, you can add no more than ten tEXt, iTXt, or zTXt chunks per pngcrush run.

-trns_array n trns[0] trns[1] .. trns[n-1]

    Insert a tRNS chunk, if no tRNS chunk found in file. Values are for the tRNS array in indexed-color PNG.

-trns index red green blue gray

    Insert a tRNS chunk, if no tRNS chunk found in file. You must give all five parameters regardless of the color type, scaled to the output bit depth.

-v (display more detailed information)

    Repeat the option (use "-v -v") for even more.

-version (display the pngcrush version)

    Look for the most recent version of pngcrush at http://pmt.sf.net

-warn (only show warnings)

-w compression_window_size [32, 16, 8, 4, 2, 1, 512]

    Size of the sliding compression window, in kbytes (or bytes, in case of 512). It's best to use the default (32) unless you run out of memory. The program will use a smaller window anyway when the uncompressed file is smaller than 16k.

-z zlib_strategy [0, 1, 2, or 3] for specified method

    zlib compression strategy to use with the preceding '-m method' argument.

-zmem zlib_compression_mem_level [1-9, default 9]

-zitxt b|a "keyword" "lcode" "tkey" "text"

    (where "lcode"==language_code and

    "tkey"==translated_keyword)"

    Compressed iTXt chunk to insert (see -text).

-ztxt b[efore_IDAT]|a[fter_IDAT] "keyword" "text"

    zTXt chunk to insert (see -text).

-h (help and legal notices)

    Display this information.

-p (pause)

    Wait for [enter] key before continuing display. e.g., type 'pngcrush -pause -help', if the help screen scrolls out of sight.

AUTHOR
 This manpage was written by xiao sheng wen for the Debian distribution and
 can be used for any other usage of the program.