image - ImageMagick - Making 2 GIFs into side by side GIFs using IM convert -


i have 2 gifs same length.

i want put gifs beside each other have 1 gif both playing @ same time. have tried use convert tool with:

convert +append 1.gif1 2.gif output.gif 

however, seems blend images , changes size extremely small.

i thinking append each image , create gif out of combined images. did not work when tried:

convert -delay 15 -loop 0 1*.png 2*.png +append output.gif 

i have lot of images long names , not want have go through individually , append each figure new naming conventions.

i don't have 2 animated gifs of same length, i'll use 2 copies of one:

enter image description here

let's @ frames in there, this:

identify 1.gif 1.gif[0] gif 500x339 500x339+0+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[1] gif 449x339 500x339+51+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[2] gif 449x339 500x339+51+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[3] gif 449x339 500x339+51+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[4] gif 448x339 500x339+52+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[5] gif 449x339 500x339+51+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[6] gif 448x339 500x339+52+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[7] gif 448x339 500x339+52+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[8] gif 448x339 500x339+52+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[9] gif 448x339 500x339+52+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[10] gif 448x339 500x339+52+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[11] gif 500x339 500x339+0+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[12] gif 500x339 500x339+0+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[13] gif 500x339 500x339+0+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[14] gif 500x339 500x339+0+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[15] gif 448x339 500x339+52+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[16] gif 500x339 500x339+0+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[17] gif 500x339 500x339+0+0 8-bit srgb 32c 508kb 0.000u 0:00.000 

mmmm, 18 frames different sizes, means need use -coalesce rebuild partial frames full ones.

let's copy , make 2.gif

cp 1.gif 2.gif 

now can split 2 gifs component frames, this:

convert 1.gif -coalesce a-%04d.gif     # split frames of 1.gif a-0001.gif, a-0002.gif etc convert 2.gif -coalesce b-%04d.gif     # split frames of 2.gif b-0001.gif, b-0002.gif etc 

now let's join individual frames side-by-side:

for f in a-*.gif; convert $f ${f/a/b} +append $f; done 

note ${f/a/b} bash-ism meaning "take value of f , replace letter 'a' 'b'".

and put them again:

convert -loop 0 -delay 20 a-*.gif result.gif 

that looks longer, , harder, because tried explain all, looks really:

convert 1.gif -coalesce a-%04d.gif                         # separate frames of 1.gif convert 2.gif -coalesce b-%04d.gif                         # separate frames of 2.gif f in a-*.gif; convert $f ${f/a/b} +append $f; done  # append frames side-by-side convert -loop 0 -delay 20 a-*.gif result.gif               # rejoin frames 

enter image description here

note conceptual code, not production quality. doesn't remove temporary files creates, nor carry inter-frame time forward original gifs. if want original frame rate them , save them array , feed delays re-animation command @ end:

identify -format "%f[%s] %t\n" 1.gif 1.gif[0] 8 1.gif[1] 8 1.gif[2] 8 1.gif[3] 8 1.gif[4] 8 1.gif[5] 8 1.gif[6] 8 1.gif[7] 8 1.gif[8] 8 1.gif[9] 8 1.gif[10] 11 1.gif[11] 11 1.gif[12] 11 1.gif[13] 11 1.gif[14] 11 1.gif[15] 11 1.gif[16] 11 1.gif[17] 26 

also, may want spacer between 2 animations, 10 pixels, can replacing convert command inside for loop one:

convert $f -size 10x xc:none ${f/a/b} +append $f 

enter image description here


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -