[net.graphics] Translating an image of 24 bits to 8 bits

phaedrus@eneevax.UUCP (Praveen Kumar) (05/07/86)

Are there any algorithms to compress a 24-bit picture into an 8-bit picture.
I know that I'll loose a lot of information and the picture won't be as good,
but at least I can display them on most graphics terminals.

Thanks in advance,

praveen

-- 
"This ain't my goddamn planet, understand monkey-boy!"

phaedrus@eneevax.umd.edu or {seismo,allegra}!umcp-cs!eneevax!phaedrus

ph@pixar.UUCP (05/12/86)

In article <656@eneevax.UUCP>, phaedrus@eneevax.UUCP (Praveen Kumar) asks:
> Are there any algorithms to compress a 24-bit picture into an 8-bit picture?

Yes, I wrote a paper discussing such algorithms:
	Paul Heckbert
	Color Image Quantization for Frame Buffer Display
	SIGGRAPH '82 proceedings, pp. 297-307

To summarize the article, a good first approximation can be achieved by
using 3 bits red, 3 bits green, and 2 bits blue.  This "uniform quantization"
does not perform well on images which use a small gamut of colors in RGB
space, or contain large areas of smooth gradation (such as a human face),
however.  For such images it is preferable to use "adaptive tapered
quantization", which means choosing a colormap which is optimized for the
distribution of colors in that image.  The method which worked best involved
(a) collecting a histogram of colors in the original image, (b) clustering
the histogram to create a colormap of the desired length, and (c) quantizing
the original image to that colormap.  The last phase entails nearest neighbor
searching in 3-D color space.  Regardless of what colormap you use, dithering
can improve the appearance of quantized images.
On a vax 780, my implementation of the above ran in under a minute.
I'm currently re-implementing it on the Pixar Image Computer,
where it should be blindingly fast.

I'll be presenting this quantization work at the Advanced Image Processing
course at the SIGGRAPH conference in Dallas, August 18-22.

I'd like to hear from those who have implemented algorithms (mine or anyone's)
for color image quantization; please e-mail.

You might check the literature in remote sensing and image processing as well,
where such algorithms are called "unsupervised multispectral classification".

-- 
Paul Heckbert
Pixar				415-499-3600
P.O. Box 13719			UUCP: {sun,ucbvax}!pixar!ph
San Rafael, CA 94913		ARPA: ph%pixar.uucp@ucbvax.berkeley.edu