Re: 8bit tiff -- Change in Behavior / Bug : 8bit, 256color, PHOTOMETRIC_PALETTE == converted to 16-bit tiff

[email protected] Fri, 28 Aug 2009 17:24:10 -0700
Newsgroups gmane.comp.video.image-magick.bugs
Message-ID <[email protected]>
> the max pixel is NOT 2^16 - the value is 65280 and not 65536.

Right.  Your image includes a colormap and the maximum value in the colormap
is 65280.

  tiffdump -m 256 image.tif
  Colormap (320) SHORT (3) 768<0 256 512 768 1024 1280 1536 ...
    62720 62976 63232 63488 63744 64000 64256 64512 64768 65024 65280>

The TIFF library includes this 16-bit to 8-bit conversion:

  #define CVT(x)  (((x) * 255) / ((1L<<16)-1))

Therefore CVT(65280) is 254, not 255 as you had suggested.