Short: Png palette optimizer Author: Jason Summers , Morphos Port by Diego Casorran Uploader: lanch tiscali it (Fabrizio "Lanch" Bartoloni) Type: gfx/misc Version: 1.2.1 Architecture: ppc-morphos Morphos port by Diego Casorran. Note from uploader: pngrewrite is best used to preprocess pngs (8 bits depth or below) before processing them with further optimizers like PngCrush or OptiPng (both available on Morphos). Many thanks to Diego Casorran for doing this port and allowing me to spread it. Visit his homepage at http://amiga.sourceforge.net for more of his portings and feel free to donate on his PayPal account to keep him doing this great service to the Amiga and clones community. pngrewrite version 1.2.1 - 8 Feb 2003 A quick and dirty utility to reduce unnecessarily large palettes and bit depths in PNG image files. ** To compile in a unix-like environment, type something like: ** cc -o pngrewrite pngrewrite.c -lpng -lz -lm Web site: This program and source code may be used without restriction. Primary author: Jason Summers Contributing authors: Wayne Schlitt - Write grayscale images when possible - Ability to sort palette by color usage - Improved find_pal_entry performance Soren Anderson - Changes to allow use in a unix-style pipeline - Improved compatibility with MinGW and Cygwin - Maintain tIME chunks Pngrewrite will: * Remove any unused palette entries, and write a palette that is only as large as needed. * Remove (collapse) any duplicate palette entries. * Convert non-palette image to palette images, provided they contain no more than 256 different colors. * Write images as grayscale when possible. * Move any colors with transparency to the beginning of the palette, and write a tRNS chunk that is a small as possible. * Reduce the bit-depth (bits per pixel) as much as possible. All of this is just basic stuff that any respectable image writing program should always do automatically, but for some reason, many of them do not. Under no circumstances does pngrewrite change the actual pixel colors, or background color, or transparency of the image. If it ever does, that's a bug. --WARNING-- This version of pngrewrite removes most extra (ancillary) information from the PNG file, such as text comments. Although this does make the file size smaller, the removed information may sometimes be important. For that reason, you should only use pngrewrite on image that were created by you. The only ancillary chunks that are NOT removed are: gAMA - Image gamma setting sRGB - srgb color space indicator tIME - creation time pHYs - physical pixel size bKGD and tRNS - Background color and transparency are maintained. The actual chunk may be modified according to the new color structure. If the original image was interlaced, the new one will also be interlaced. Pngrewrite will not work at all on images that have more than 256 colors. Colors with the same RGB values but a different level of transparency count as different colors. The background color counts as an extra color if it does not occur in the image. It will also not work at all on images that have a color depth of 16 bits, since they cannot have a palette. This is a very inefficient program. It is (relatively) slow, and uses tons of memory. To be specific, it uses about 5 bytes per pixel, no matter what the bit depth of the image is. This program is (hopefully) reasonably portable, and should compile without too much effort on most ANSI C compilers. It requires the libpng and zlib libraries.