[Image-SIG] How do I load and display a 16 bit grayscale image?

Roy H. Han starsareblueandfaraway at gmail.com
Thu Sep 25 23:53:30 CEST 2008


I'm having some trouble displaying an image and I was wondering if someone
here can help.

Specifically, I loaded a 16 bit grayscale image using the fromstring()
method with mode I;16.  When I try to display the image, the entire image is
white with some specks of black.  I think it is because PIL thinks that it
is a color image, but I'm not sure.

Is there a way to tell PIL that the 16 bit image is actually grayscale?

The details are that I am opening GeoTIFFs using GDAL and using PIL's
fromstring() to see the resulting images.  The multichromatic image seems to
display fine when I view each band individually (PIL's merge doesn't seem to
work for 16 bit images yet).  However, the panchromatic image is washed out
in white and I can't see anything.  When I open the panchromatic image in
qGIS, however, all the trees are plainly visible.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/image-sig/attachments/20080925/d6451d94/attachment.htm>

More information about the Image-SIG mailing list