[Image-SIG] TIFF16 greyscale to color image

Fredrik Lundh fredrik at pythonware.com
Fri Dec 8 14:12:20 CET 2006

Stephane Henry wrote:

> Could someone point me an efficient way to transform 16 bits
> greyscale tiffimage to a color image; or more simply how to create a
> color image from an array of value with the possibility to choose the
> palette, like the function imshow from Matplotlib.

quick recipe:

- use getextrema to get the min/max value for the image (unless already

- use point to translate the image down to an "L" image; you can use either
  a the argument*scale+offset form, or a 64k lookup table:


- use putpalette to attach a palette to the L image:


- if necessary, convert back to RGB.


More information about the Image-SIG mailing list