Basically, I want to get the most common ARGB value that appears in a BitmapData. That is, I want to know which exact pixel colour is the most abundant in the image. I tried going through every pixel of the image and counting whenever a colour that already exists comes up, but that's way too slow, even with relatively small images. Does anybody know a faster method for this, maybe using the BitmapData.histogram() function or something?
Ideally the process should be near instantaneous for images around at least 1000x1000 pixels.
0xFF89ae00, and 10 that are0xFFae0089, the resultant colour I would get would be0xFF89ae00, because that's the colour that most pixels have. - puggsoygetPixel32(): now I see thatgetVector()is better for this use, but I hadn't used it before Vesper's answer. - puggsoy