Python Image Manipulation

deelan ggg at zzz.it
Wed Aug 25 15:10:51 EDT 2004


Scott Brady Drummonds wrote:
> Can anyone recommend the easiest way of generating thumbnail images using a
> Python library?  I've seen that the Python Image Library (PIL) seems to do
> this but it isn't installed on my available systems.  I'd prefer to use
> something distributed with Python, if possible, but will install the library
> that makes this functionality easy as a second choice.

i'm not aware of python built-in functions to resize images,
but with PIL is dead easy to make thumbnails, check:

from "Python is Kung-Fu for the Web":
<http://blog.mans.de/archives/2004/03/28/python-is-kung-fu-for-the-web/>

import Image
im = Image.open(filename)
im.thumbnail((200, 200), Image.ANTIALIAS)
im.save(thumbnail, "JPEG", quality = 80, optimize = 1)

you can also feed to open() a file(-like) object, instead
of a filename.

HTH,
deelan.





More information about the Python-list mailing list