ImageFileScan
ImageFileScan[f,inputfile] applies the function f to the list of channel values for each pixel of the image stored in inputfile.
Examples
Count pixels in an image file:
n = 0; ImageFileScan[(n++ &), "image.png"]; nPlease visit the official Wolfram Language Reference for more details.