How to improve ImageMagick thumbnail generation significantly!

morten795

Joined: 2005-12-16
Posts: 2
Posted: Fri, 2005-12-16 08:48

Hi,

I've been implementing Gallery 1.51 on a Network Attached Storage box (Synology DS101g) and had a lot of problems with the performance when Gallery 1.51 was generating thumbnails. I took a look at the code performing the resize (util.php) and compared it to the resizing code of yappa-ng (a different image gallery), which is very quick at resizing.

Now, I found that by simply reordering the parameters to ImageMagicks' convert tool the performance was improved by a magnitude of ~10-15!, which is significant on a NAS device, which doesn't have a big CPU or a lot of RAM (it went from ~1 min to 5 secs to convert an image!).

I asked on the ImageMagick users list to confirm that what I had found was a better way of doing the conversion - and somebody replied that the best way to perform the conversion is:

convert -size 150x150 test.jpg \
-strip -coalesce -resize 150x150 \
-quality 100 test.thumb.jpg

And it can be further improved by replacing the -strip and -resize with
-thumbnail which does both.

The reply on the ImageMagick list can be read in full here: http://studio.imagemagick.org/pipermail/magick-users/2005-December/016896.html

I hope this can go into the next version of Gallery 1 (I don't know if version 2 suffers from the same problem).

Best Regards,
Morten Nielsen

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Fri, 2005-12-16 09:04

Hello Morten,

i guess you are using ImageMagick 6.x.

Galley 1.5.1 is not optimized for this version.
1.5.2-cvs is :)
There are exactly those things done.
Maybe you want to try 1.5.2-cvs ...

regards and thanks for reporting,

Jens
--
Last Gallery v1 developer and translation manager.

 
morten795

Joined: 2005-12-16
Posts: 2
Posted: Fri, 2005-12-16 11:05

Ok, that's excellent - I'll give the 1.5.2 CVS version a spin then :)

 
Tim_j
Tim_j's picture

Joined: 2002-08-15
Posts: 6818
Posted: Fri, 2005-12-16 11:40

great, it be nice if you could give feedback (in a new thread)

Jens
--
Last Gallery v1 developer and translation manager.