I tried comparing the hex values directly, but there were inaccuracies,
maybe the same ones you've been having. I think since the value of a
particular color precedes with a 0 even when it's below 17(0F), the
preceding 0 causes a shifting in the comparison. It would, for example,
cause 0x000000 to seem farther to 0x123456 than 0x00FF00, where visually you
can see clearly that black is closer to 0x000000.

btw in my example, var a = 0x12345 where it should be 0x123456.

The numbers hold to be accurate after correcting this typo.

On 3/15/06, Josh Buhler <[EMAIL PROTECTED]> wrote:
>
> I'm working on a project that requires that I take an uploaded image,
> and convert it to use a limited palette of colors - around 5-10 colors.
>
> I've got the custom palette I have to work with stored in an array,
> and for each color in my image, I've got it finding the color in the
> array it's closest to numerically, but the results aren't exactly
> what I'm looking for.
>
> Does anybody know of any formulas available for comparing multiple
> colors and finding the ones that are the closest matches? I've been
> searching Google for a while, with no luck. Any good resources on
> color formulas & such would be appreciated.
>
> - Josh
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
>
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to