The total number of pixels is not equal to the sum of values in your image.
sumOfAllPixelValues = sum(double(rgbImage(:)));
numberOfPixels = numel(rgbImage);
The size on disk of an image is numberOfPixels*bytesPerPixel
, where bytesPerPixel
depends on the bit depth of an image (uint8
would be 8 bits=1 byte, for example.
To downsample the image by half, you can either reduce the bit depth (e.g. going from uint16
to uint8
, or you reduce the number of pixels by sqrt(2)
in height and width, for example using imresize
.
solved Total Number of pixels in an image [closed]