(bitmapdata) change colors to the dominate color in that range?

hey all,

I am working on a outlines script that converts a image in black outlines and the rest WHITE.

is there a math formula that converts colors in the same color range to the dominate color of that range?

so all light red becomes WHITE and the already dark redpresent in the image stay’s darkred.

I am have a cool function that makes outlines but that is not perfect with a jpg with many colors…

so i do this:

1: image convert to 10 -16 colors
2: loop wxh, hxw and make outlines to setPixel (black) if color is different!
3: MY QUISTION ABOVE :slight_smile: help?

Best Regards,

Manga