.TH ppmquant 1 "12 January 1991" .IX ppmquant .SH NAME ppmquant - quantize the colors in a portable pixmap down to a specified number .SH SYNOPSIS .B ppmquant .RB [ -nofloyd | -nofs ] .RB [ -nolimit ] .RB [ -writemap ] .I ncolors .RI [ ppmfile ] .br .B ppmquant .RB [ -nofloyd | -nofs ] .RB [ -nolimit ] .B -map .I mapfile .RI [ ppmfile ] .fi .SH DESCRIPTION Reads a portable pixmap as input. Chooses .I ncolors colors to best represent the image, maps the existing colors to the new ones, and writes a portable pixmap as output. .IX "colormap reduction" .PP The quantization method is Heckbert's "median cut". .IX "median cut" .PP Alternately, you can skip the color-choosing step by specifying your own set of colors with the .B -map flag. The .I mapfile is just a .I ppm file; it can be any shape, all that matters is the colors in it. For instance, to quantize down to the 8-color IBM TTL color set, you might use: .nf P3 1 8 255 0 0 0 255 0 0 0 255 0 0 0 255 255 255 0 255 0 255 0 255 255 255 255 255 .fi If you want to quantize one pixmap to use the colors in another one, you can just use the second one as the mapfile. You don't actually have to reduce it down to only one pixel of each color, you can just use it as is. However, if you do want to produce a special colormap file, just one pixel per color, you can use the .B -writemap flag. .PP The .BR -nofloyd / -nofs flag disables a Floyd-Steinberg error diffusion step. .IX Floyd-Steinberg .IX "error diffusion" Floyd-Steinberg gives vastly better results on images where the unmodified quantization has banding or other artifacts, especially when going to a small number of colors such as the above IBM set. However, it does take slightly more CPU time, so you can turn it off if you like. .PP The .BR -nolimit flag disables error limiting. .IX "error limiting" This is a modification to standard Floyd-Steinberg error diffusion to try and prevent ugly "singleton" pixels from popping up in the middle of otherwise smooth-shaded areas. The idea is to allow diffused errors to modify a pixel value by only so much, and after that it gets limited. For most colormaps this works quite well, but occasionally you may want to disable it and allow full error diffusion. For instance, the 8-color IBM TTL colormap shown above works much better without limiting. .PP All flags can be abbreviated to their shortest unique prefix. .SH REFERENCES "Color Image Quantization for Frame Buffer Display" by Paul Heckbert, SIGGRAPH '82 Proceedings, page 297. .br "Digital Halftoning" by Robert Ulichney, MIT Press, ISBN 0-262-21009-6. .SH "SEE ALSO" ppmquantall(1), pnmdepth(1), ppmdither(1), pbmplus(1) .SH AUTHOR Copyright (C) 1989, 1991, 1994 by Jef Poskanzer. .\" Permission to use, copy, modify, and distribute this software and its .\" documentation for any purpose and without fee is hereby granted, provided .\" that the above copyright notice appear in all copies and that both that .\" copyright notice and this permission notice appear in supporting .\" documentation. This software is provided "as is" without express or .\" implied warranty.