[Image-SIG] PIL probs on Debian when resizing

abel deuring adeuring at gmx.net
Tue Dec 12 16:29:14 CET 2006


Hi Michela,
> Hi 
> 
> I'm using the latest python-imaging package available for my Debian install
> (1.1.5-11) and unable to get image resizing working. 
> 
> I think the problem is my install because all the sample code I can find is
> almost identical. I've deleted and reinstalled the package and tested that
> the package and methods are available to the application.
> 
> Any advice?
> 
> This code produces a corrupted thumbnail which is mainly black
> 
> 				avatar = Image.open(path)
> 				avatar.size = (128,128)

Here you set simply an attribute of the image object to a new value,
which does not match the real, unchanged, image data.

> 				avatar.save(filename, "JPG")
> 
> This code doesn't produce any file at all. Neither does changinig format to
> PNG
> 
> 				avatar = Image.open(path)
> 				avatar.thumbnail((128,128), Image.ANTIALIAS)
> # doesn't work at all
> 				avatar.save(filename, "JPG")

This should result in "Key Error: 'JPG'". Try 'JPEG' instead.

Abel


More information about the Image-SIG mailing list