[Image-SIG] Re: resize a image

Fredrik Lundh fredrik@pythonware.com
Fri, 9 May 2003 18:04:03 +0200

> I tried to resize an image but failed. The script and error
> messages are shown as below:

> ValueError: unknown resampling filter

> The filter argument can be nearest, bilinear or bicubic. I tried and got
> same message.

the filter argument must be one the constants defined in
the Image module:

     im = im.resize((400,400), Image.NEAREST)

also note that NEAREST is the default, and that im.thumbnail
is usually a much faster way to create a thumbnail, especially
when the input files are large JPEG files...:

    im = Image.open('pd0001_contype.jpeg')
    im.save('pd0001_contype.thumbnail', "JPEG")