Reputation: 1270
How do I batch resize animated gifs with imagemagick? I have this script which works for single images but I must specify both the exact image name.
convert {path to image with filename}.gif -coalesce -resize 200x200 \
-layers optimize-frame {output name}.gif
mogrify -path seems to batch process but animations all come out broken with mogrify.
Upvotes: 1
Views: 514
Reputation: 207455
You don't say if you are using OS X, Linux or Windows, but if on either of the first two and using bash
, you can use a loop:
for f in CurrentLocation/*.gif; do convert "$f" -coalesce -resize... -layers... NewLocation/$(basename "$f"); done
If you are unfortunate enough to have to use Windows, it will look something like this:
FOR %%G IN (SOMEWHERE/*.GIF) DO convert "%%G" -set filename:new "%f" -coalesce -resize... -layers... "elsewhere/%[filename:new]"
Upvotes: 2