On Mon, Apr 21, 2008 at 7:51 PM, Brion Vibber <brion(a)wikimedia.org> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Bryan Tong Minh wrote:
It got me annoyed as well. So I finally got
around writing a png
resizer that does not need to load the entire file into memory:
<http://svn.wikimedia.org/viewvc/mediawiki/trunk/pngds/>. I took a
6000x4000 PNG from that category and recompressed it to a 640px image
in only 4 seconds, while taking only a few 100KB of memory.
Sweeet! How does that compare to ImageMagick's speed on the same image?
About the same order of magnitude. I could only test on the
toolserver, which is horribly overloaded, so might not give very
reliable results. Anyway, here are the results:
>> imc = 'convert PSF_B-90003.png -size
240x360 PSF_B-90003-im.png'
>> pngds = './pngds PSF_B-90003.png PSF_B-90003-pngds.png --width 240 --height
360'
>> import os, time
>> it = []; pt = []
>> for i in xrange(10):
... t = time.time()
... os.system(imc)
... it.append(time.time() - t)
... t = time.time()
... os.system(pngds)
... pt.append(time.time() - t)
...
>> it
[29.209415912628174,
38.37901782989502, 36.218145132064819,
23.519179105758667, 29.034934043884277, 23.346055030822754,
31.353446960449219, 16.032020092010498, 20.690651893615723,
7.4122297763824463]
>> pt
[34.830365896224976,
24.175456047058105, 28.614557027816772,
18.715215921401978, 17.986761093139648, 18.512807130813599,
20.611849069595337, 12.038840055465698, 9.5885701179504395,
5.7849969863891602]
I would say that my tool is slightly faster, but I can't say for sure.
Bryan