Re-sizing images in Python?

David Eppstein eppstein at
Sat Jul 14 20:35:39 EDT 2001

In article <q6547.41446$B56.8781902 at>,
 "Darren Watson" <Darren.Watson3 at> wrote:

> I would like to write a script that can process all the files in a directory
> and resize the images to a specified size (passed in as an argument).
> However, I am not sure if this is a task that Python 2.1 can perform or if
> it is, which library to use.

This is not difficult to do using the Python Imaging Library.
If you are doing significant size reductions, you probably want to smooth 
the image a little first to avoid pixelization problems.

Contact me by email if you want me to send you some code I wrote to do this 
as part of a web photo gallery generation applet (see for results). My program uses 
Mac-specific user interface code so would require significant modification 
to run on your PC, but the image resizing stuff should be pretty portable.
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at

More information about the Python-list mailing list