Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
<== Date ==> <== Thread ==>

Subject: Re: 32-bit TIFFs and PIL
From: "J. Lewis Muir" <jlmuir@imca-cat.org>
To: Mark Rivers <rivers@cars.uchicago.edu>
Cc: "dvine@aps.anl.gov" <dvine@aps.anl.gov>, Timothy Madden <tmadden@aps.anl.gov>, Ross Harder <rharder@aps.anl.gov>, "tech-talk@aps.anl.gov" <tech-talk@aps.anl.gov>
Date: Tue, 20 Mar 2012 11:25:50 -0500
On 3/20/12 8:03 AM, Mark Rivers wrote:
> Hi Tim (and tech-talkers),
> 
> I know you've done quite a bit with TIFF files, so I've got a question for you.
> 
> The areaDetector NDFileTIFF plugin can write 8-bit, 16-bit and 32-bit TIFF files.  All of them can be read fine by ImageJ and IDL.  However, the 32-bit TIFFs cannot be read by the Python Imaging Library (PIL).  But 32-bit TIFF files written by the Dectris Pilatus driver can be read by PIL.
> 
> Do you have any idea what needs to be done to make a 32-bit TIFF readable by PIL?

Hi, Mark.

Part of the problem is that the generic PIL.Image.open method
discards exceptions from the image format handlers so the
exception you get is not a very useful one.  You can get a
better exception by using the TiffImagePlugin directly to open
the image which is what is handling TIFF images by default in
PIL 1.1.7.  Here's what I get with Python 2.7.2:

===
>>> import PIL.TiffImagePlugin
f = PIL.TiffImagePlugin.TiffImageFile(fp="/tmp/im.tif")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/opt3/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/ImageFile.py",
line 91, in __init__
    self._open()
  File
"/opt3/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/TiffImagePlugin.py",
line 528, in _open
    self._seek(0)
  File
"/opt3/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/TiffImagePlugin.py",
line 556, in _seek
    self._setup()
  File
"/opt3/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/PIL/TiffImagePlugin.py",
line 637, in _setup
    raise SyntaxError, "unknown pixel mode"
SyntaxError: unknown pixel mode
===

So it seems to be unhappy about the pixel mode.

Lewis

Replies:
Re: 32-bit TIFFs and PIL J. Lewis Muir
References:
32-bit TIFFs and PIL Mark Rivers

Navigate by Date:
Prev: Re: 32-bit TIFFs and PIL Timothy Madden
Next: Re: 32-bit TIFFs and PIL J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
Navigate by Thread:
Prev: Re: 32-bit TIFFs and PIL Timothy Madden
Next: Re: 32-bit TIFFs and PIL J. Lewis Muir
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·