[Image-SIG] Re: Image-SIG digest, Vol 1 #273 - 1 msg
Tue, 16 May 2000 06:11:19 +1000
> To summarize, I need to:
> - resize images of different sizes to (275, x)
> - generate the best quality I can
> Basically, I'd like the thumbnail functionality with better output quality.
> I'm sure I'm simply not doing something correctly.
> Perhaps a snipet of code would do me best.
### Get some stats from the uploaded image
im = Image.open(pict_file_path)
pict_hires_x = im.size
pict_hires_y = im.size
### If the image is too big, resize it to 200x150ish
if pict_hires_x > 200 or pict_hires_y > 150:
newx = 200
newy = 150
if pict_hires_x > pict_hires_y:
newy = pict_hires_y * newx / pict_hires_x
newx = pict_hires_x * newy / pict_hires_y
im = im.resize((newx,newy),Image.BICUBIC)
I think you should be able to just change the sizes and
fire the sucker up.
Kingsley Turner, mailto:firstname.lastname@example.org
Mad Dog's Breakfast:
The Travel Magazine that doesn't take itself too seriously