Centering mixed size images when creating animated GIF

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
Sharok
Posts: 2
Joined: 2019-06-12T19:52:06-07:00
Authentication code: 1152

Centering mixed size images when creating animated GIF

Post by Sharok »

Hi, I create an animated gif from mixed size images, but the smaller images are not centered. I want the smaller images to be centered instead of being on the left side or on the top. Can you help please? What options do I add to my command to center the images?

Here is the command I use:
convert -resize 668x476 -delay 400 -dispose background -loop 0 -gravity Center *.jpg ani.gif
Last edited by Sharok on 2019-06-12T21:34:43-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Centering mixed size images when creating animated GIF

Post by fmw42 »

Proper syntax reads the input images before doing any resize.

Try

Code: Select all

convert -delay 400 -dispose background *.jpg -resize 668x476  -gravity Center -background white -extent 668x476 -loop 0  ani.gif
Sharok
Posts: 2
Joined: 2019-06-12T19:52:06-07:00
Authentication code: 1152

Re: Centering mixed size images when creating animated GIF

Post by Sharok »

You are awesome. That worked very well. Thanks very much.
Post Reply