#26014 - tomer - Fri Sep 03, 2004 1:00 pm
how do I convert 16bit RGB color into 8-bit color?
thanx in advance
#26015 - poslundc - Fri Sep 03, 2004 2:28 pm
The easy way is to get Photoshop or GIMP to convert it from RGB mode to indexed colour, with 256 colours. Photoshop has a Save for Web feature that also lets you do this type of conversion; I forget what comparable features GIMP has.
Dan.
#26036 - keldon - Sat Sep 04, 2004 12:04 pm
with the GIMP you can change the pallette to the web pallette. If I remember correctly, it is right-click --> image --> pallette
it's something of that nature anyway
#26041 - poslundc - Sat Sep 04, 2004 4:13 pm
Is that converting to 8-bit, or is it making your image "web-safe"? Because the latter is a poor choice for GBA images, as it constricts the colours to a palette that is far more restrictive than (even) what the GBA offers.
Dan.
#26339 - pan69 - Mon Sep 13, 2004 10:17 am
Quote: |
how do I convert 16bit RGB color into 8-bit color? |
I guess you want to do this realtime? Well, that's pretty simple. You'll have to use a Color LookUp Table (CLUT).
First thing you need to do is to create a 256 color palette that has most of the common colors in it or some sort of spectrum (or you can just use the one that comes with Quake I which is pretty good!).
Second, you'll have to create your lookup table. Since the GBA has only 15bit colors your table will become 32768 bytes in size (because that's the number of possible colors you can have with 15bit and for a 256 color palette you only need a 8bit index). Now for every 15bit color, you scan the 256 color palette for the color that comes closed to the RGB components of this 15bit color and you store index of your match into your lookup table. Thats it!
Now, at runtime you can convert every 15bit color to an corresponding 8bit index into your palette.
- Pan