count the number of pixels of a certain color - RealWorld forums

Log-in or register.

count the number of pixels of a certain color

in RW-Paint
GodRage
on October 7th 2022

I need to check how many pixels of a certain color is used in an image.

The perfect scenario: I colorpick on a pixel in my image, and in the palette it tells how many pixels are from this color.
It would be good if the output can be turned on/off.
It should then recalculate after each action in the image, to keep an accurate number.

As a script, I guess it will be less appealing (sort of popup over the image?) but still very useful.

I hope someone could help me! I don't know how to make such script.. And can't even find online tool that do such thing correctly.

Vlasta
on October 7th 2022

Well, a full plug-in and a re-configuration of the layout would be needed to add this functionality in full.

A script is run only when you press a button, so a script could be created that would let the user select a color and then counted how many pixels in the current layer have this color and then a message box with the number would pop up.

Perhaps if I understood what problem are you trying to solve, I could suggest a simpler solution.

GodRage
on October 7th 2022

Yes, you understood what is the situation. ^^

I am willing to hear your simpler solution. :-)

I found a work-around with gimp (but 300+MB program T.T, too heavy for me), using the Histogram.
Found another work-around with irfanview, the Histogram do not tell how many pixel from y color there is, but seems I can compare the global amount of colors. (but then I don't know what color I must replace.)
So it's not an hurry, but I would certainly prefer to get this information in RW-Paint than another program. ^^

Vlasta
on October 7th 2022

The histograms usually show relative values per color channel (or grayscale). It could be hard to find out how many pixels of certain color there are as there may be different colors with the same amount of for example red. I still do not understand the purpose of this function. What is the final goal?

GodRage
on October 8th 2022

In my case, I take the original textures of a game (Minecraft), it is 16x16.
I upscale them to 32x32 and make more detail in it. But, I want to keep the exact same amount of each exact color (#CCCCCC is not the same as #CCCCCD), because I want the final look to be rendering as much as possible the same for both the "16x16 original texture player" and the "32x32 texture player".

I think this tool would also be helpful for making variation of textures for any game.
I am very sensitive to colors (because of colorblind), so keeping the same amount would be a great tool for me. (but maybe not for others, that's right).

Page views: 618       Posts: 5      
Vista & Win 7 icons
I wish there were...
Select background