2004.01.14 17:36 "Re: [Tiff] COLORMAP and byte padding", by Joris Van Damme
I really wouldn't do that.
0 to 256 -> 0,
257 to 513 -> 2,
Philip Crews wrote:
> Using integer division, the only 16-bit pixel value that will
> result in white (255) is 0xffff, and 0x0100 will incorrectly be black
You misunderstood. I should have thought about / with integer operands being an integer divide in C (right?). In ObjectPascal, it's a floating divide. I actually meant to denote the floating division, and rounding afterwards. That should make more sense.
Also, I tend to look at it from the theoretical point of view. If 0 maps to 0, and 65535 maps to 255, then the mapping formulae quite simply is /65535*255. Plus rounding, of course.