# count red pixels

## Recommended Posts

I everyone,

I need to know if paint net (free version) is enable to count the % of one colour in an image (for example % of red )

thanks!!

##### Share on other sites

There is no unfree version. :-)

But no, there is no way.

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

##### Share on other sites

You could.... I guess (if you are measuring the % of red in a square) you could do it a hard way (if anyone has better, reply and put me to shame.)

drag your selection down to the bottom of your red for example, then look at the "bounding rectangle size," multiply the width by the height, then the width by the height of the whole canvas. Then divide the larger by the smaller and multipy that by 100. Simple!

(Canvas width*Canvas height)/(Selection width*Selection height)*100

(800*600)/(800*432)*100 = 72% red pixels (but this ONLY works for SQUARES if not then there is no other way than to manually count them :wink:)

##### Share on other sites

drag your selection down to the bottom of your red for example, then look at the "bounding rectangle size," multiply the width by the height, then the width by the height of the whole canvas. Then divide the larger by the smaller and multipy that by 100. Simple!

That's assuming all of the red is in one block.

##### Share on other sites

(but this ONLY works for SQUARES if not then there is no other way than to manually count them :wink:)

"SQUARES" should be "Rectangles". A square is a rectangle too. One with a all sides equal.

Also, it only works with 1 single rectangular selection. Having 2 rectangular selections with a space between wouldn't work.

Merry Christmas

.::.My Gallery.::.Make Gold Text!.::.

##### Share on other sites

That's assuming all of the red is in one block.

Yes, which is very unlikely I guess if someone had the time they could make a plugin that does this for you but I don't think many people would use it, so I doubt it will ever be made.

Oh, you could do 2 rectangualr selections or more, just do one, then the other then add them together (%)

##### Share on other sites

Um... when you create a selection, sure you see the selection width and height.... but you also see the actual size in pixels.

So just use magic wand to select globally all the red you want, and just read the number in the status bar? No percentages, no calculating.... just reading a number?

##### Share on other sites

No, it will still only show the dimentions in square form, so if it's a circle its no good, plus you would still need to work out, using a caluclation, the amount of pixels in %.

##### Share on other sites

Yes, the dimensions are rectangle, width and height... but the area is in pixels, showing a simple number.

##### Share on other sites

Oh, sorry i missed that bit. :oops:

##### Share on other sites

I would like to have a plugin that can count a pixel with the same color or in a specific color range in RGB. And maybe so it should be able to select them too. Would be usefull for me, when i am working with textures with black background in a BMP file.

##### Share on other sites

If enough people are interested it would be trivial for me to write such a plugin.

##### Share on other sites

Well, we are 2 persons right now. I hope other people is interrested too, since i've been waiting for a plugin like this in some time now. Thx for at least taking notice

##### Share on other sites

Now correct me if I'm wrong, but using the wand with a tolerance of 0% and flood mode of global should select every instance of your (clicked on) target colour. Isn't that right?

If I'm correct, then once you have your selection, the above post by Zagna shows us where to find the number of currently selected pixels.

Is this not easier than writing a plugin or am I missing something?

##### Share on other sites

Continuing from what EER said (who is correct btw)..

With the area you could calculate the %, just divided the selection area by the canvas area and multiply by 100.

Merry Christmas

.::.My Gallery.::.Make Gold Text!.::.

##### Share on other sites

The only catch is that you first have to find a pixel that is the color you want.

Or, just temporarily set any pixel to that color, do the magic wand thing, then subtract 1 from the area. Then undo the pixel's color.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

##### Share on other sites

I doubt someone would want to find the percentage of pixels in an image that are a colour they can't even find. :?

##### Share on other sites

I doubt someone would want to find the percentage of pixels in an image that are a colour they can't even find. :?

Isn't that what computers are for? Plus it's quicker to find via the method I just mentioned than to do so manually (depending on image size, of course).

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

##### Share on other sites

I mean find to click on one of the pixels.

##### Share on other sites

Let's say that this is a compressed JPEG photo and you accidentically deleted the PDN file. Now you want the transperancy back, but the magic wand always leaves something left. Maybe there is a lot of small places where there is white between the actual object, like on photos of trees, bushes, plants etc. That is why that a tool like this could be usefull :wink:

##### Share on other sites

Look for the Color To Alpha Plugin. Or just put the Magic Wand on Global mode. :-)

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

##### Share on other sites

So, I expect that you just do a fast magic wand on art like this?

##### Share on other sites

So, I expect that you just do a fast magic wand on art like this?

Whoa. That is killing the selection render performance on my v3.5 Alpha here. Looks like I found a good performance test case. Thanks

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×