Page 1 of 1

Batch resize creates animated gif

Posted: 2012-04-02T13:07:06-07:00
by btilford
I'm using the following command to resize all images in a directory to multiple sizes. If one of the images in the directory happens to be a gif the output is an animated gif. Any tips on how to prevent this? Preferably without needing to do multiple executions. Looking at the commands and flags work it seems like it would be hard to parse that an animated gif should not be created

Code: Select all

convert /somedir/*.* +clone -resize 1000x1000 -set filename:f 'resized/%t_1000.%e' -write '%[filename:f]' +delete +clone -resize 600x600 -set filename:f 'resized/%t_600.%e' -write '%[filename:f]' +delete +clone -resize 320x320 -set filename:f 'resized/%t_320.%e' -write '%[filename:f]' +delete -resize 80x80 -set filename:f 'resized/%t_80.%e' '%[filename:f]'

Re: Batch resize creates animated gif

Posted: 2012-04-02T13:35:51-07:00
by fmw42
you can use +adjoin to make it output to separate images. see http://www.imagemagick.org/script/comma ... php#adjoin

Re: Batch resize creates animated gif

Posted: 2012-04-02T21:10:31-07:00
by anthony
First you are cloning an image without using parentesis. A sure sign you are not doing things right!

You are reading in a image, clone it, resize BOTH images, write TWO images, then delete the last image only!
Using parenthesis, you deperate the original input image from the resize and writes, and thus prevents the duplications.

The parenthesis must be space seperated from the other options (they are themselves a seperate option).

See writing an image multiple times, in IM examples...
http://www.imagemagick.org/Usage/files/#write

ASIDE: IMv7 will error on the use of clone outside parenthesis! It was never ment to be used outside parenthesis!

Also make sure the input image is NOT itself a multi-image file (GIF, ICO, MNG, etc)