Loading Big-Endian Floating Point TIFF Files

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Loading Big-Endian Floating Point TIFF Files

Aaron VanDevender-2
Hello Python Image folks,

I'm using PIL 1.1.7.

I would like to load a TIFF file that stores its pixels in 32-bit big-endian floating point format. When I use Image.open it reads the file and mode is given as "F;32BF", however if I use the convert or getdata methods I get:

/usr/lib/python2.7/dist-packages/PIL/ImageFile.pyc in load_prepare(self)
    229         if not self.im or\
    230            self.im.mode != self.mode or self.im.size != self.size:
--> 231             self.im = Image.core.new(self.mode, self.size)
    232         # create palette (optional)

    233         if self.mode == "P":

ValueError: unrecognized mode


However, if I say

    image_tiff = Image.open(file_tiff)

    if image_tiff.mode == "F;32BF":
        image_tiff.mode = "F"
    image = numpy.asarray(image_tiff)

It will .convert() properly. It seems that there is a bug in the TIFF loader that is mistaking the raw mode for the mode.

-Aaron

_______________________________________________
Image-SIG maillist  -  [hidden email]
http://mail.python.org/mailman/listinfo/image-sig