wok-current view pngrewrite/description.txt @ rev 23692

updated tcplay (2.0 -> 3.3)
author Hans-G?nter Theisgen
date Mon Apr 27 06:44:33 2020 +0100 (2020-04-27)
parents
children
line source
1 Pngrewrite is command-line utility that reduces the unnecessarily large
2 palettes that some programs write into PNG files. It also optimizes
3 transparency data, and reduces the bits-per-pixel if possible. Handy for
4 post-processing PNG files before putting them on a web site.
6 Pngrewrite will:
8 * Remove any unused palette entries, and write a palette that is only as large
9 as needed.
10 * Remove (collapse) any duplicate palette entries.
11 * Convert non-palette image to palette images, provided they contain no more
12 than 256 different colors.
13 * Move any colors with transparency to the beginning of the palette, and write
14 a tRNS chunk that is a small as possible.
15 * Reduce the bit-depth (bits per pixel) as much as possible.
16 * Write images as grayscale when possible, if that is compatible with the goal
17 of using the minimum possible bit depth.
19 Under no circumstances does pngrewrite change the actual pixel colors, or
20 background color, or transparency of the image. If it ever does, that's a bug.
22 --WARNING--
24 pngrewrite removes most extra (ancillary) information from the PNG file, such
25 as text comments. Although this does make the file size smaller, the removed
26 information may sometimes be important.
28 The only ancillary chunks that are NOT removed are:
30 * gAMA - Image gamma setting
31 * sRGB - srgb color space indicator
32 * tIME - creation time
33 * pHYs - physical pixel size
34 * bKGD and tRNS - Background color and transparency are maintained. The
35 actual chunk may be modified according to the new color structure.
37 If the original image was interlaced, the new one will also be interlaced.
39 Pngrewrite will not work at all on images that have more than 256 colors.
40 Colors with the same RGB values but a different level of transparency count as
41 different colors. The background color counts as an extra color if it does not
42 occur in the image.
44 It will also not work at all on images that have a color depth of 16 bits,
45 since they cannot have a palette.
47 -----------------
49 This is a very inefficient program. It is (relatively) slow, and may use a lot
50 of memory. To be specific, it uses about 5 bytes per pixel, no matter what the
51 bit depth of the image is.
53 This program is (hopefully) reasonably portable, and should compile without too
54 much effort on most C compilers. It requires the libpng and zlib libraries.
56 The pngrewrite code is structured as a library that could be used in other
57 applications, but I have not documented the interface.
59 -----------------
61 How to use:
63 From a command-line, run
65 pngrewrite.exe <input-file.png> <output-file.png>
67 To read from standard-input, or write to standard-output, use "-" for the
68 filename.