www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/13/04:00:33

From: Till Harbaum <harbaum AT ibr DOT cs DOT tu-bs DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro BMP Color Depth Conversion
Date: 13 Feb 1998 09:57:31 +0100
Organization: TU Braunschweig, Informatik (Bueltenweg), Germany
Lines: 29
Distribution: world
Message-ID: <yks4t23evb8.fsf@flens.ibr.cs.tu-bs.de>
References: <199802130327 DOT TAA12223 AT adit DOT ap DOT net>
NNTP-Posting-Host: flens.ibr.cs.tu-bs.de
Mime-Version: 1.0 (generated by tm-edit 7.106)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Nate Eldredge <eldredge AT ap DOT net> writes:

> 
> At 07:02  2/12/1998 GMT, Keith Bonawitz wrote:
...
> >either 24-bit.  How can I convert these 24-bit images to 256 color
> >images?  I understand that an palette has to be created that matches

> I think you would be more likely to get a good answer if you ask on
> comp.graphics.algorithms. However, I do know that the program `display' has
> several 24->8 conversion algorithms, and I *think* the source is available.
> Check the `graphics' directory of a Simtelnet site.
> 

This is one of the classic problems in computer graphics. You might take
a look at the source of the pbmplus-package by Jef Poskanzer. I solved
my color reduction problem by adopting the algorithm in ppmquant.c
of this package. The famous x11 image viwer/converter 'xv' uses the
same routines. This package uses the median cut algorithm based on
Paul Heckbert's paper "Color Image Quantization for Frame Buffer Display", 
SIGGRAPH '82 Proceedings, page 297. It assumes that all your pixels are
stored in a color cube. Now you cut the color cube into smaller ones 
with the intention to have the same ammount of pixels in each of the
new small cubes. After creating for example 256 cubes you calculate the
'gravity center' of all pixels inside each cube and take that as the
new color value for all pixels placed in that cube.

Ciao,
  Till

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019