PIL always raises "unrecognized image mode" exception with putdata()

Noah noah at noah.org
Fri Feb 13 18:12:11 EST 2004


"Cousin Stanley" <CousinStanley at hotmail.com> wrote in message news:<c093j2$145o03$1 at ID-130333.news.uni-berlin.de>...
> | ....
> | im.save ('target out.png', 'png')
> | ....
> Noah ....
>   Try the image type in all-caps .... 
>    im.save( 'targe out.png' , 'PNG' )
>   Also, you might try the Image save method 
>   with just the filename and omit the type argument .... 
>    im.save( 'target out.png' )
>   Unless you specify the format, the library 
>   uses the filename extension to discover 
>   which file storage format to use.

But my problem is with getdata() and putdata().
The PIL raises the exception even when saving or loading is not involved.
For example, the following script raises the exception 
"TypeError: unrecognized image mode.

    import Image
    width = 10
    height = 10
    im = Image.new ("RGB", (width, height))
    im.putdata (im.getdata())

Yours,
Noah



More information about the Python-list mailing list