There is an interesting thread currently at the image-sig mailing list about downsampling images. The methods suggested by Douglas and Franz might be interesting techniques to add to Phatch or is it just clutter? What do you think?
---------- Forwarded message ---------- From: Douglas Bagnall <[email protected]> Date: Wed, Jun 3, 2009 at 3:57 AM Subject: Re: [Image-SIG] Lanczos interpolation To: [email protected] If you want the downsampling algorithm used by the Gimp and (I think) Photoshop, try: def stretch(im, size, filter=Image.NEAREST): im.load() im = im._new(im.im.stretch(size, filter)) return im In 2005 I found it to be a few times quicker than ANTIALIAS resizing, and the results were better from what I was doing. (From http://mail.python.org/pipermail/image-sig/2005-May/003310.html) Douglas _______________________________________________ Image-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/image-sig > > On Sun, May 10, 2009 at 12:45 PM, David Yan <[email protected]> wrote: > > I want to resize an image Lanczos interpolation but I haven't found any > > python module that can do so. Also, I'm not knowledgeable enough to write > > one myself. What's the best way I can do this? I use PIL currently but the > > resampling filters don't suit my needs (antialias is too slow, bilinear and > > bicubic produce aliasing when downsampling). > > ANTIALIAS is a Lanczos interpolation written in C, so it's not > entirely obvious to me how you expect a Python version to be faster... > > </F> ---------- Forwarded message ---------- From: Franz Buchinger <[email protected]> Date: Tue, Jun 2, 2009 at 1:58 PM Subject: Re: [Image-SIG] Lanczos interpolation To: [email protected] A good old trick is to work with intermediate images: resize the image using the Bilinear method and produce an intermediate image that is about 25% larger than the final image. Then you can downscale the intermediate image using Lanczos. This should give a much better performance than working just with Lanczos, especially for large downscaling ratios (e.g. 10 Megapixel JPEG -> 1024x768) . Image quality shouldn't be affected too much by this method. Franz -- Phatch Photo Batch Processor - http://photobatch.stani.be SPE Python IDE - http://pythonide.stani.be _______________________________________________ Mailing list: https://launchpad.net/~phatch-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~phatch-dev More help : https://help.launchpad.net/ListHelp

