Re-sizing images in Python?

Johann Hibschman johann at
Mon Jul 16 17:19:00 EDT 2001

akhar  writes:

> Look into PIL(python Imaging library) has all you need.
> Stephane

Exactly.  Here's some sample code I wrote using PIL, just to give you
the idea:

def resize (filename_in, filename_out, quality=None, size=(400,300)):
    "Read a file from filename_in, resize, then output to filename_out."
    im = (filename_in)
    out = im.resize (size, Image.BILINEAR)
    if quality: (filename_out, quality=quality)
    else: (filename_out)

Johann Hibschman                           johann at

More information about the Python-list mailing list