[Image-SIG] The Image.resize problem with BICUBIC and BILINEAR

Buddy Zdankiewicz bzdank@sprynet.com
Wed, 5 Sep 2001 15:25:56 -0700


I saw a thread in last months archive about people struggling with image
resize issues.

I started out my Python learning curve by trying to make a jpeg slide show
viewer similar to the one on theO'Reilly Book's accompanying CD (2nd edition
covers python 2.0). I wanted to add some auto scaling/sizing. Everything
seemed to work well, and there seemed to be differences between NEAREST and
BICUBIC so I was happy.

from the OReilly distribution
# 99-07-28 fl PIL release 1.0 final
#
# Copyright (c) 1997-99 by Secret Labs AB.
# Copyright (c) 1995-97 by Fredrik Lundh.

and python 2.0


I didn't start to run into Image.resize problems until after going through a
minor upgrade hell.After eventually getting Python 2.1 and IDLE 0.8
installed the original PIL files I was using seemed not to work at all. But
my upgrade process may have been to blame.

I downloaded the latest Pil file from PythonWare and things at least ran,
but the BILINEAR and BICUBIC options produced no recognizable image, only a
single colored horizontal line. NEAREST worked as always.

I wrote a loop that resized a 400x600 image from 1x1 all the way to 800x800.
Oh yeah, it was a jpeg image, I haven't tried any other types.

scale value            result
1x1-16x16           varying mottled squares
17x17 - 21x21    recognizable image
22x22 and greater was one or two horizontal colored lines.

I am also over my head when looking at the source for Image.pi. It seems
like resize leads to and endless recursion and I can't see where the
BILINEAR value gets used, other than for a recognized value test.

I could send some source if that is of interest



Edward Zdankiewicz
bzdank@sprynet.com
(415) 461-8535