Page 1 of 1

Creating multiple thumbnails without re-reading original

Posted: 2011-07-05T08:38:38-07:00
by mef
I'm trying to create multiple thumbnails of different dimensions from an original without re-reading the original each time, in a single convert command.

The command that seems to work best is:

Code: Select all

convert 'original.jpg' -write mpr:orig +delete \
mpr:orig -resize 'x150>' -write '150.jpg' +delete \
mpr:orig -resize 'x400>' -write '400.jpg' +delete \
mpr:orig -resize '900>' '900.jpg'
I'm wondering if there's a better way?

I've tried +clone, which seems to be slightly slower than mpr:

Code: Select all

convert 'original.jpg'  \
\( +clone -resize 'x150>' -write '150.jpg' \) -delete 1 \
\( +clone -resize 'x400>' -write '400.jpg' \) -delete 1 \
-resize '900>' '900.jpg'
And I've also tried +write, but it seems that each thumbnail uses the output of the previous thumbnail instead of the original. In this code, the 900> thumbnail will be the same as the x150> thumbnail.

Code: Select all

convert 'original.jpg' -resize 'x150>' +write '150.jpg' \
-resize '900>' +write '900.jpg' \
-resize 'x400>' '400.jpg'
Any tips would be appreciated. Thanks!

Re: Creating multiple thumbnails without re-reading original

Posted: 2011-07-05T10:28:50-07:00
by fmw42
I would expect your mpr approach to be the best and fastest as mpr is in-memory.