I’ve struggled with colors in Xojo and RB since forever.
The big picture is , I work with images that can come from any source.
Open them in Xojo to work with.
Compare the pixel RGB values to a predefined list of colors.
eg these:
https://en.wikipedia.org/wiki/Web_colors
Either the X11 range or ‘web safe’ stuff
And I want to end up with a version of the image that only contains pixels of these websafe colors, and no others.
That means going from millions of colors down to maybe 256
Ive failed to find a decent quantisation method, and currently am using something from GraphicsMagic as a stogap.
Here are my problems: (they may all be the same thing)
a/ Colorspace (?) - I open an image in Xojo and just by looking at it, the colors dont match what I see in Preview or iPhoto
b/ Comparing… I have had a number of algorithms ove the years, but if I look at one pixel and get the RGB vales, then try to find the closest match in that list of colors, the one I end up with is usually darker than the original, or quite different, even though (to my eye) , better choices exist.
c/ Colors always seem darker using Xojo to manipulate them
eg I see a Bright Blue, but working on R,G,B comparisons, I end up ‘selecting’ something much darker blue.
Or getting a purple for a brown.
So:
Does anyone else have the same experience?
How would YOU go about finding the best match for one of these web colors from any random image?
I note in this article that the web safe colors were established due to monitors with a 16bit display.
I havent seen one of these for years, but still need to work the principle.
I dont think the root cause is a 16bit color display, but what is it that makes Xojo change the colors so?