[comp.graphics] Mapping 24-bit graphics to a pixed palette

ge@dbf.kun.nl (Ge' Weijers) (02/13/91)

In some soft/hardware environments you do not have any control over the set
of colours that can be displayed. Is it possible to get reasonable results
by using an algorithm analog to Floyd-Steinberg for the case black-white, i.e.
selecting the 'nearest' colour in the palette, and then distributing the error
over the surrounding pixels.
To be more specific: what measure of 'nearness' to use, etc.

Any pointers to literature, algorithms would be appreciated.

Ge'

--
Ge' Weijers                                    Internet/UUCP: ge@cs.kun.nl
Faculty of Mathematics and Computer Science,   (uunet.uu.net!cs.kun.nl!ge)
University of Nijmegen, Toernooiveld 1         
6525 ED Nijmegen, the Netherlands              tel. +3180652483 (UTC-2)

spencer@eecs.umich.edu (Spencer W. Thomas) (02/20/91)

In article <2758@wn1.sci.kun.nl> ge@dbf.kun.nl (Ge' Weijers) writes:
> In some soft/hardware environments you do not have any control over the set
> of colours that can be displayed. Is it possible to get reasonable results
> by using an algorithm analog to Floyd-Steinberg for the case black-white, i.e.
> selecting the 'nearest' colour in the palette, and then distributing the error
> over the surrounding pixels.

The Utah Raster Toolkit (see the FAQ for info on retrieval) has a
program 'rledither' to do this.  Its input is a colormap and an image,
the output is an 8-bit image that has been FS dithered to the
colormap.  It offers optional edge sharpening.  It's only drawback is
that it is currently somewhat slow.  The upcoming 'patch 3' has a
faster program for dithering 24-bit images to 8 bits (rledither will
handle input with any number of (8-bit) color channels, so is more
general.)

Both programs use a simple "Euclidean distance" measure (sum of
squares of distance in RGB space).  This may or may not be correct,
but it's easy and has some basis in physics, if not in perception.

--
=Spencer W. Thomas 		EECS Dept, U of Michigan, Ann Arbor, MI 48109
spencer@eecs.umich.edu		313-936-2616 (8-6 E[SD]T M-F)