Some are in gray scale, some are not… So, I need to come up w/ logic that could be used for all colors… I’m guessing that I’ll have a rough week… ah… some have recommended that I make a sum of R + G + B and that’s the index value… however… it’s not very accurate. For example if R=255,G=0,B=0 then the value is 255, and another color R=0,G=0,B=255… then this logic would be ambiguous since both color value is 255. I’m not color expert but I’m guessing Blue is more darker than Red… ah… if I could get hold of the RGB chart that list from lightest to darkest like
Hm… Color Distance… that sounds very fascinating. For now, I’m ignoring Red and Blue value. Just going w/ Green… yeah… it’s only 90% of the time correct… x:x Thanks for the advice though.
I would consider taking an average of the 3 values.
Not positive that will work for you properly, but it might be worth the try. However, if you do averages then white would be 255 and black out be 0.
You might also look into HSB (Hue, Saturation, Brightness) values to help with your indexing.
I was just playing with the color wheel dialog in GIMP and that gave me the idea of also looking at HSB.
Are you also concerned about keeping shades of colors together?
If you are, you might consider using something called color distance. I did a few searches and there are a few tools that will compute that distance for you. (Do a google search for “java ColorUtil”).
FYI: 255 is the max value, but because zero is included, we get 256 possible values. Which is no surprise when you consider that 2^16 = 256. 256^3 = 16 million colors (which should sound familiar) - 16,777,216 to be exact.
I bumped into the math for converting from RGB to HSB…ouch
I can see your index as a 3D array, but I’m puzzled as to what values you would store there…