I just noticed that PixelIntensityToQuantum returns 0 for a PixelPacket of (65535, 65535, 65535). This is probably due to the conversion of 65535.5 from float to Quantum. Has anyone else encountered this? For now, I just removed the +0.5 from the function but am puzzled that nobody else ran into this.
Thanks,
Niels.
PixelIntensityToQuantum returns 0 for (65535,65535,65535)
Re: PixelIntensityToQuantum returns 0 for (65535,65535,65535)
PixelIntensityToQuantum() returns 65535 for us as expected. What OS and compiler are you using? Which version of ImageMagick? What is your quantum depth, Q8 or Q16?
Re: PixelIntensityToQuantum returns 0 for (65535,65535,65535)
This happened to me on Mac OS X 10.4.8 (Darwin Kernel Version 8.8.1) using i686-apple-darwin8-gcc-4.0.1.
If I remove the round up correction (+0.5), the problem goes away. My quantum size is 16 bits.
Niels.
If I remove the round up correction (+0.5), the problem goes away. My quantum size is 16 bits.
Niels.