This is a follow up on my previous posts about PIL/gd speed comparisons, which is perhaps now a bit of a misnomer. It is now really just a C/python speed comparison for custom intensive image operations given it is clearly possible to access the same sort of raw data with both gd and PIL within C.
My real end goal is to find the best way to make CPU intensive imaging apps go *much* faster, but still be able to use python & PIL/gd for the bulk of the code. Specifically I have created two implementations here of a hill shading algorithm using PIL, with one version using pure python, the other using python and a c implementation for the core loop. For this particular implementation the relative speedup for the specific example given was about 20 times for the python/c version over the pure python version. A 2300x1900 input image yielded essentially the same speedup ratio. It wasn't too hard to do the core C part of the code since it was so similar to the python version. It was a little fiddly getting the python-c interface code together, and navigating down to the raw data inside PIL. However now this is done this should not be a real hindrance to any further implementations like this. Full details including the code, and sample input & output images are here : http://www.langarson.com.au/blog/?p=14 I'm not sure how easily this implemented using array operations in numpy given nature of the algorithm, and in turn how relatively efficient it would be. Comments welcome. :) Cheers, JB. -- John Barratt - www.langarson.com.au Python, Zope, GIS, Weather _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig