delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/02/17/08:53:40

From: "Daniel Nilsson" <daniel7 AT algonet DOT se>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro BMP Color Depth Conversion
Date: 16 Feb 1998 17:58:44 GMT
Organization: Algonet/Tninet
Lines: 21
Message-ID: <01bd3b04$b44e9a00$0100007b@Strider>
References: <34E34724 DOT BC1D0B5D AT geocities DOT com>
NNTP-Posting-Host: du232-2.ppp.algonet.se
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp


Keith Bonawitz <aule AT geocities DOT com> 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
> most of the colors reasonably well, but how would I go about doing
> this?  I would appreciate either ready-to-use allegro extensions or a
> reference to an algorithm that could be used.

Allegro 3.0 can convert 24-bit images to 256-color palette images
automatically when you load them. Just do this at the start of your program
after allegro_init ():

set_color_depth (8);				// 256 color palette
set_color_conversion (COLORCONV_TOTAL);	// Convert everything to current
color-depth

Then when you load your bitmaps, using the load_* functions, allegro will
create an optimized palette for you, and convert the bitmaps to 256 color.

/ Daniel Nilsson

- Raw text -


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