View Full Version : Counting the amount of RGB pixels in an image
kmfdm
08-31-2007, 06:32 PM
Kind of an off topic question but I figured someone that used GIMP/PS a lot might know.
I'm wondering if it's possible to get a breakdown of red, green and blue pixels in an image. So out of 10 pixels, it would break it down to be 1 red, 4 blue, 5 green.
Thanks in advance if someone actually knows.
BerenAndLuthien
08-31-2007, 06:43 PM
Depends on what you're looking at.
Why do you want to know?
Edit: Didn't read your question properly. Photoshop might have something like this. Let me check..
ducks
08-31-2007, 06:50 PM
Provided your image contains only pure red, green or blue pixels, you can use the histogram in whatever package you're using. In PS for example, load up the histogram, change the channel to red, and mouse over the graph to level 255, and observe the count underneath.
Bear in mind this will also count pixels that have a pure red component (for example, white, which is pure red, green and blue added together)
kmfdm
08-31-2007, 07:06 PM
Thanks for the help guys. I work in QA and the Quality Engineer asked me to research this, so I'm not 100% on the question. As far as I understand he's wondering if there's a filter that would count the number of pixels that have a majority of red, a majority of green and a majority of blue color. So the filter would group the pixels into those 3 categories and output the number of each pixel in each category.
The images we'd use this on would be very microscopic, low resolution (say, 480x300) pictures taken from a smartscope.
I appreciate any help you guys can give but it sounds like this filter hasn't been written yet considering I don't see much of a use for it. Thanks again, though.
Kamikazee
08-31-2007, 07:07 PM
Errr... Why is this actually in the Editing section? :rolleyes:
kmfdm
08-31-2007, 07:09 PM
Errr... Why is this actually in the Editing section? :rolleyes:
I just figured there'd be people here that use GIMP and Photoshop a lot.
ducks
08-31-2007, 07:20 PM
Ok, yes, this is in the wrong section. It could potentially be related to megatexturing, but it ain't.
Still, you could still use the PS histogram to get an idea of which colour is most common in the image. Just change between the red, green and blue channels and look at the mean value given for each.
Sublim3
08-31-2007, 07:22 PM
Is this for a magazine?
Anywho, ducks method is what i used last time I needed to know pixel color #s.
kmfdm
08-31-2007, 07:31 PM
I'll give it a try, thanks.