views:

584

answers:

1

Dear Stackoverflow'ers,

I am creating custom images that I later convert to an image pyramid for Seadragon AJAX. The images and image pyramid are created using PIL. It currently take a few hours to generate the images and image pyramid for approximately 100 pictures that have a combined width and height of about 32,000,000 by 1000 (yes, the image is very long and narrow). The performance is roughly similar another algorithm I have tried (i.e. deepzoom.py). I plan to see if python-gd would perform better due to most of its functionality being coded in C (from the GD library). I would assume a significant performance increase however I am curious to hear the opinion of others. In particular the resizing and cropping is slow in PIL (w/ Image.ANTIALIAS). Will this improve considerable if I use Python-GD?

Thanks in advance for the comments and suggestions.

EDIT: The performance difference between PIL and python-GD seems minimal. I will refactor my code to reduce performance bottlenecks and include support for multiple processors. I've tested out the python 'multiprocessing' module. Results are encouraging.

+1  A: 

PIL is mostly in C.

Antialiasing is slow. When you turn off antialiasing, what happens to the speed?

Jonathan Feinberg
Actually tried this after I posted. It is much quicker using BILINEAR and give comparable results aesthetically. Also, the performance of the resize method is comparable between PIL and python-GD (10% difference in speed).
Vince