delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/21/03:56:56

Message-ID: <380EA7CE.DAFF2DA@snetch.cpg.com.au>
Date: Thu, 21 Oct 1999 15:42:38 +1000
From: Michael Abbott aka frEk <20014670 AT snetch DOT cpg DOT com DOT au>
Organization: Student of Computer Power Institute
X-Mailer: Mozilla 4.05 [en] (Win95; I)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: What is a good palette for 8-Bit Grafix?
References: <7uhdij$sfb$1 AT rohrpostix DOT uta4you DOT at> <380D499C DOT F017D7D8 AT snetch DOT cpg DOT com DOT au> <380E052C DOT 11DC03E9 AT gtcom DOT net>
Reply-To: djgpp AT delorie DOT com

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 -


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