Tiff Image Reader/writer

James Carroll mrmaple at gmail.com
Wed Jun 15 21:28:06 EDT 2005


What do you mean by decode the pixels?  If there's some image
processing that needs to be done, or if you want to view, brighten, or
print or something, then there are ways of doing it that will be as
fast as can be.  If stepping through the pixels  to do your own math
is what you want, then maybe something that puts the pixels in
numarray / scipy / etc. form is what would work for you.

Reading a large image is going to take some time no matter what
language or tool you use... How long does it take a viewer program to
open and display your tiff image?

How fast is the following for your image? (you'll need wxPython)

    import wx

    wx.InitAllImageHandlers()


    # time the following line
    image = wx.Image('yourfilename.tif')
    print "the image is %ix%i" % (image.GetWidth(), image.GetHeight())
    print "the greenness pixel at 10,10 is", image.GetGreen(10,10)

wxWidgets uses libtiff directly, so it will be about as fast as can
be, but wxWidgets does assume that the image is RGB for most
operations.

The Kitware ITK   (Insight Toolkit)  can read lots of variations of
multi-tiff images, and do tons of different kinds of manipulation on
them...  the only downside is its footprint and learning curve.


-Jim

On 6/15/05, Marc 'BlackJack' Rintsch <bj_666 at gmx.net> wrote:
> In <mailman.396.1118698763.10512.python-list at python.org>, Robert Kern
> wrote:
> 
> > PyPK wrote:
> >> One reason why I don't want to use PIL is it seems very slow for tiff
> >> images of very large sizes(2400x4800). So I am looking for a better
> >> tool than does the right job faster.
> >
> > This isn't fast enough?
> >
> > In [8]: %time img2 = Image.open('foo.tiff')
> > CPU times: user 0.00 s, sys: 0.01 s, total: 0.01 s
> > Wall time: 0.03
> >
> > In [9]: img2.size
> > Out[9]: (2400, 4800)
> 
> It's fast enough to open the file and read the meta-data.  The OP wants to
> decode the actual pixels.
> 
> Ciao,
>         Marc 'BlackJack' Rintsch
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
>



More information about the Python-list mailing list