PixelIntensityToQuantum returns 0 for (65535,65535,65535)

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
provos

PixelIntensityToQuantum returns 0 for (65535,65535,65535)

Post 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.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post 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?
provos

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

Post 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.
Post Reply