Page 1 of 1

thumbnail file size

Posted: 2013-09-07T04:53:28-07:00
by djeyewater
With ImageMagick 6.5.9 when I resize an image to 500 pixels on the longest side and then resize this to a 150 pixels on the longest side thumbnail, the thumbnail has a much smaller file size than just resizing straight to a thumbnail without the intermediate 500px version.

For my test file I get a thumbnail file size of 4.6kB when first resizing to 500px. When resizing straight to thumbnail I get a file size of 15.5kB, quite a big difference.

I then tried the latest version of ImageMagick, 6.8.6-9. This doesn't have a big difference between the way the thumbnail is created - from a 500px file is 8.3kB vs. 8.5kB straight from the larger file. But this is worse performance than 6.5.9 when resizing to 500px before creating the thumbnail.

Code: Select all

~/apps/ImageMagick/bin/convert \
-filter Lanczos \
medium.jpg \
-set option:filter:filter Lanczos \
-set option:filter:blur 0.8 \
-resize 500x500 \
-quality 80 \
small.jpg

~/apps/ImageMagick/bin/convert \
medium.jpg \
-strip \
-thumbnail 150x150 \
thumb-from-medium.jpg
#6.8.6-9=8.5kB 6.5.9=15.5kB

~/apps/ImageMagick/bin/convert \
small.jpg \
-strip \
-thumbnail 150x150 \
thumb-from-small.jpg
#6.8.6-9=8.3kB 6.5.9=4.6kB
I've uploaded the test file I was working on here: http://www.iliveinabin.com/resize-test/medium.jpg

When I compiled 6.8.6-9 it didn't originally build with jpeg and tiff support, so I had to point it to jpeg and tiff libs, and I used libjpeg-turbo for the jpeg lib, which I guess might be what is causing the difference?

Does anyone know

1) Why I get such a big difference in the thumbnail file size with 6.5.9 depending on whether the image has been resized down to 500px or not?
2) Why the thumbnail file size is larger with 6.8.6-9 and how I can reduce it?

Thanks

Dave

Re: thumbnail file size

Posted: 2013-09-07T05:37:44-07:00
by snibgo
Medium has quality 98, so thumb-from-medium (in v6.8.6-9) also has quality 98.

You explicity make small of quality 80, hence thumb-from-small has quality 80.

As you may know, lower quality numbers give smaller file sizes (but lower quality).

If you want even smaller files, decrease the quality further.

Re: thumbnail file size

Posted: 2013-09-07T08:30:19-07:00
by djeyewater
Thanks for the answer, it seems obvious now you point it out! :oops:

Cheers

Dave

Re: thumbnail file size

Posted: 2013-09-07T09:02:10-07:00
by snibgo
Pleasure. Answers are often obvious when we know what they are!

Thanks for including your code, IM versions and sample image. Queries often don't include these vital ingredients, and diagnosis can be a long and drawn out process.