Re-sizing images in Python?
Johann Hibschman
johann at physics.berkeley.edu
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 = Image.open (filename_in)
out = im.resize (size, Image.BILINEAR)
if quality:
out.save (filename_out, quality=quality)
else:
out.save (filename_out)
--
Johann Hibschman johann at physics.berkeley.edu
More information about the Python-list
mailing list