[Numpy-discussion] reading tiff images
mat.yeates at gmail.com
Tue Apr 26 15:09:53 EDT 2011
is scikits.image.io documented anywhere?
On Tue, Apr 26, 2011 at 11:45 AM, Zachary Pincus
<zachary.pincus at yale.edu> wrote:
> On Apr 26, 2011, at 2:31 PM, Daniel Lepage wrote:
>> You need PIL no matter what; scipy.misc.imread, scipy.ndimage.imread,
>> and scikits.image.io.imread all call PIL.
> scikits.image.io also has a ctypes wrapper for the freeimage library.
> I prefer these (well, I wrote them), though apparently there are some
> 64-bit issues (crashes?). I haven't been working on a 64-bit system so
> I haven't been able to address them, but I will be soon. It's a very
> thin wrapper around a simple image IO library, so there's lots of room
> to add and extend as need be...
> All of the PIL wrappers are kluges around serious flaws in how PIL
> reads images, particularly non-8-bit images and in particular non-
> native-endian 16-bit images.
>> Theoretically there's no difference between any of them, although in
>> actuality some use "import Image" and others use "from PIL import
>> Image"; one of these may fail depending on how you installed PIL. (I'm
>> not sure which is supposed to be standard - the PIL docs use both
>> interchangeably, and I think the latest version of PIL on pypi sets it
>> up so that both will work).
>> I'd use whichever tool you're already importing - if you're using
>> ndimage anyway, just use ndimage.imread rather than adding more
>> Note that using PIL directly is easy, but does require adding an extra
>> step; OTOH, if you're familiar with PIL, you can use some of its
>> transformations from the start, e.g.
>> def imread(fname, mode='RGBA'):
>> return np.asarray(Image.open(fname).convert(mode))
>> to ensure that you always get 4-channel images, even for images that
>> were initially RGB or grayscale.
>> On Tue, Apr 26, 2011 at 2:00 PM, Mathew Yeates
>> <mat.yeates at gmail.com> wrote:
>>> What is current method of using ndiimage on a Tiff file? I've seen
>>> different methods using ndimage itself, scipy.misc and Pil.
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at scipy.org
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
More information about the NumPy-Discussion