Archived

This topic is now archived and is closed to further replies.

Mihail121

Palette generation

Recommended Posts

Mihail121    100
Ok guys here it goes... i have given RGB data which i want to palettize.The number of palette entries is 256.Does anyone have any idea how to palettizing is performed.Just a quick algorithm or something.10x! "Tonight we strike,there is thunder in the sky,together we''ll fight,some of us will die,but they''ll always remember that we''ve made a stand and many will die by hand!" - ManOwaR

Share this post


Link to post
Share on other sites
Tristan10    122
An easy way is this:

run a quick frequency-analysis of the RGB data;
and select the 256 most used colors.

There is a downfall to this method though: suppose
the 2 most used colors are RGB(255, 0, 0) and RGB(254, 0 , 0)
this would mean that both this colors will be used for your
pallete...but there''s very little difference between them.

So an optimisation might be:

[PSEUDOCODE]

1. make frequency analysis

2. get most used color in list
3. compare with colors allready in list
4. if difference with all colors is high enough
put this color in the list as well and goto 2, else goto 2

[/PSUEDOCODE]

But I believe the best method is described in several articles
all over the web; using neural networks. I''m sorry I can''t explain that..because I know about uuh..NOTHING on neural networks.

Share this post


Link to post
Share on other sites
Mihail121    100
10x pal you''re method works with few modifications.I run through the data fill a 256 entries list than i run through the data again comparing the other colors.If there is a difference hight enough replace color.Else continue.10x a lot!

"Tonight we strike,there is thunder in the sky,together we''ll fight,some of us will die,but they''ll always remember that we''ve made a stand and many will die by hand!" - ManOwaR

Share this post


Link to post
Share on other sites