Mail Archives: djgpp/1999/10/21/03:56:56
Heya
> Michael Abbott aka frEk wrote:
> >
> > Heya
> >
> > What immediately comes to mind is using a palette sort of truecolor like... ie.
> > Instead of for example the hicolor 5-5-5 palette, within 8 bits you use a 3-3-2
> > palette which means 3 bits of red, 3 for green, 2 for blue...
> > Short program:
> >
> BLA BLA BLA...sorry,you was making my head hurt.
>
> Lookhere feller,since you seem to know so much about
> colors and stuff,why dont you answer me this:
> suppose i gots an 8 bit palette that has some
> colors in it like so:
I can't help but feel this is a jest on my part, but I'll go with it anyway...
> ,--r g b
> | | | |
> 0--0,0,0
> 1--1,7,9
> 2--2,8,9
> 3--5,1,2
> 4--7,8,3
>
> and
>
> i also gots a pixel on my screen that wants to
> be as close to 1,6,2 as it can be,but can only
> choose from the existin palette of colors.
Do you mean you're converting an image (ie. a pixel of an image) or just any specific
pixel?
If it's an image, use a dithering algorithm otherwise you're screwed anyway :(
> what would be a good way of figurin out what
> color i allready gots what is closer to the
> color i wants than the rest of them colors i
> allready got?
Well, find which of the colours gives this formula the best result:
closeness = 0.59*abs(R - r) + 0.70*abs(G - g) + 0.11*abs(B-b)
or closeness = ?(abs(R-r)+abs(G-g)+abs(B-b)) / 3 (faster, and faster still if you use
a fixed point reciprical for * 1/3)
The reason for that is that humans see the RGB components in this order of
brightness: GRB
It might be the other way around (I'd have to play around) because we see contrast
differences in this order: BRG
> and fer trivia porposes witch of them colors
> up there is closest to 1,6,2 ?
Use the formula...
> to everyone else
> I reckon this is off topic kinda,but this fella seems
> like he knows a thing or 2 about colors so i felt like
> i had to ask while i hads me a chance.
Hmmm...
- Michael
- Raw text -