wok-current annotate pngrewrite/description.txt @ rev 22530

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