simple image processing in python

Robert Roy rjroy at takingcontrol.com
Wed Oct 11 15:19:05 EDT 2000


On Wed, 11 Oct 2000 11:42:46 -0400, Randall Hopper <aa8vb at yahoo.com>
wrote:

>Kevin Cazabon:
>
> |You can easily get the sizes of the files with PIL, without loading the
> |entire image.
>...
> |PIL doesn't actually load the data until you perform an operation that
> |requires that it is loaded... so just getting the size is very quick, even
> |with a 400MB image file.
>
>Can you read the pixels from a big image with PIL (say, line-by-line), or
>are you limited to listing header info.
>
PIL has a lot of features. Why don't you download the user guide and
see for youself.
http://www.pythonware.com/library.htm
Bob

>------------------------------------------------------------------------------
>>>> im = Image.open( "penn_mrlc.tif" )
>>>> im.size
>(24758, 13716)                             <---------------------
>>>> im.info
>{'compression': 'raw'}
>>>> len( im.tile )
>13716
>
>>>> im.thumbnail( (128,128) )
>Traceback (innermost last):
>  File "<stdin>", line 1, in ?
>  File "/home/rhh/software/python-1.5.2/lib/python1.5/site-packages/PIL/Image.py", line 723, in thumbnail
>    self.load(1)
>  File "/home/rhh/bin/../software/python/lib/python1.5/site-packages/PIL/ImageFile.py", line 134, in load
>    d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
>  File "/home/rhh/software/python-1.5.2/lib/python1.5/site-packages/PIL/Image.py", line 225, in _getdecoder
>    return apply(decoder, (mode,) + args + extra)
>ValueError: unknown raw mode
>------------------------------------------------------------------------------
>
>-- 
>Randall Hopper
>aa8vb at yahoo.com
>




More information about the Python-list mailing list