[Numpy-discussion] import 16-bit tiff - byte-order problem?

Zachary Pincus zachary.pincus@yale....
Fri Nov 7 07:33:31 CST 2008


The PIL has some fundamental architectural problems that prevent it  
from dealing easily with 16-bit TIFFs, which are exacerbated on little- 
endian platforms. Add to this a thin sheen of various byte-order bugs  
and other problems in the __array_interface__, and it's really hard to  
get consistent loading of 16-bit tiffs across platforms. (I and many  
others have submitted patches for these issues to no avail.)

A while ago, I tried to see if I could graft the image file format  
parsers from the PIL onto a byte-loading backend that used numpy.  
Unfortunately, I really couldn't -- the parsers assume too much about  
the problematic architecture of the PIL.

I do have a private fork of the PIL that I made which remedies the  
bugs and above-mentioned architectural issuse, and works cross- 
platform, and with any endian system. (It's very restricted compared  
to the regular PIL -- basically it just does image IO and then  
converts to numpy arrays.) I haven't released this because I don't  
really want to make trouble -- and we're promised that a major  
revision of the PIL is in the offing which will fix these troubles --  
but I'm happy to send the code out to those who actually need reliable  
16-bit image IO.


More information about the Numpy-discussion mailing list