Relatively new to using the Magick++ API and I'm running into problem setting the RGB color depth of an image I'm reading in. The image is 24 bit encoded RGB, but the Magick++ API is returning pixel values that are 48 bit encoded. Below is an example of what I doing;
Code: Select all
image.read("image.jpeg");
pix = image.pixelColor(10,10);
red = pix.redQuantum();
im_depth=image.depth();
fprintf(stdout,"Color depth: %u\n",im_depth);
fprintf(stdout,"Red value: %u\n",red);
In this case, red has a value of 65,536 and depth is 8. I would like the values to be 24 bit encoded (i.e. values 0 - 256), but can't seem to find a way to do this. Reading through the documentation it seems Magick might store the RGB values in memory differently than what the image is saved in. I've seen mention of QuantumDepth that is defined at compile time and am guessing this is what is causing the difference.
Any help would be appreciated.
Bryan