How can I find the amount of pixels in part of an image?

Solution 1:

In Gimp, the "Histogram" dialog applies to the selection, so the pixel count displayed is the pixels in the selection (weighted by their selection level):

In the image below the selection covers the black circle which has a 100px radius. The Pixels value is close to 100²*Pi (314000 instead of 314159).

enter image description here

The Count is the number of pixels between the two values indicated by the handles at the bottom of the histogram.

Of course the selection can have any shape and be obtained with various tools.

I assume PS has something equivalent.