I'm trying to work out how many colour possibilities are used per pixel for any given image.
For example, if an image uses 8 bits per pixel, then it can represent one of 256 shades.
I'm looking for something like the following:
CImg<unsigned char> inputImage(inputImageFilename.c_str());
CImgDisplay disp_input(inputImage,"input");
std::cout << sizeof(inputImage[0]);
I know that this particular image has 8 bit pixel depth. I was hoping this would output 8, which I could then use as the exponent of 2 to get 256 (2^8 = 256). But it outputs 1, so this is not an option.
I've also tried .depth()
but quickly realised this does not refer to the pixel depth.
Can someone help me out?