Page 1 of 1

PixelIntensityToQuantum returns 0 for (65535,65535,65535)

Posted: 2007-02-05T03:35:57-07:00
by provos
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.

Re: PixelIntensityToQuantum returns 0 for (65535,65535,65535)

Posted: 2007-02-05T08:54:10-07:00
by magick
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)

Posted: 2007-02-05T19:24:51-07:00
by provos
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.