Page 1 of 1

Animated gif images onto static image; undesired results

Posted: 2019-02-20T16:21:57-07:00
by Don
Hello,

My IM version is: ImageMagick 6.9.6-3 Q16 x86_64 2016-11-05
My platform is: Linux

I am trying to place more than one animated gif image onto a static image. Everything is fine(no errors) except for the result. One of the animated gif images (left arrow gif image) 'blinks' as you'll see from the resulting image. The down arrow gif image animates fine.

Here is my command:

Code: Select all

convert background.png null: \( downArrow.gif -coalesce \) -gravity Northwest -compose over -layers composite null: \( leftArrow.gif -coalesce \) -gravity SouthEast -compose over -layers composite -layers Optimize gifResult.gif
Down arrow gif image: https://www.dropbox.com/s/idups8p346ytc ... w.gif?dl=0
Left arrow gif image: https://www.dropbox.com/s/5ut4d745mdha9 ... w.gif?dl=0
Result gif image: https://www.dropbox.com/s/dsopmzlglrdw6 ... t.gif?dl=0

Is it possible to get the animated gif images to animate on the static image as intended without any blinking?

Thank you in advance.

Re: Animated gif images onto static image; undesired results

Posted: 2019-02-20T17:22:14-07:00
by snibgo
The down arrow has 36 frames. The left arrow has only 28 frames. How many frames do you want in the result? Which input frames do you want to drop (or duplicate) to get that number?

Re: Animated gif images onto static image; undesired results

Posted: 2019-02-20T17:32:08-07:00
by fmw42

Re: Animated gif images onto static image; undesired results

Posted: 2019-02-20T17:38:05-07:00
by Don
HI snibgo,

In order to get a smooth animation result, frames have to be dropped or duplicated to an equal amount per gif image?

Hmm not sure which to drop or duplicate. Is it possible to duplicate frames of the one with the less frames to the gif that has the most frames? So in other words, the left arrow has 28, can we add more frames to it to make it 36 frames?

Thank you. Much appreciated.

Re: Animated gif images onto static image; undesired results

Posted: 2019-02-20T18:50:05-07:00
by snibgo
Well, I don't know what result you want. One input cycles in 28 frames and the other cycles in 36 frames.

If you want a result with 28 frames, you need to remove 8 frames from down arrow. If you want 36 frames you need to add 8 frames to left arrow. The added frames might duplicate one or more frames, or might be blank.

Another possibility is to have 252 frames in the output. Then one cycle of the output has exactly 9 cycles of left arrow and 7 cycles of down arrow.

Re: Animated gif images onto static image; undesired results

Posted: 2019-02-20T23:40:41-07:00
by Don
To avoid the possibility of duplicating one or more frames or get blank when adding frames, lets go with 28 frames then.

Re: Animated gif images onto static image; undesired results

Posted: 2019-02-20T23:59:07-07:00
by fmw42
If you are going to loop indefinitely, then you would be best with snibgo's suggestion of integer multiple of your frames such that they produce the same counts.

Also you may have trouble if the delays are not the same in the two animations. See my link above to Anthony's notes about merging

Re: Animated gif images onto static image; undesired results

Posted: 2019-02-21T06:01:43-07:00
by snibgo
I find long commands easier to understand when split into lines. Bash syntax:

Code: Select all

convert \
  toes.png \
  null: \
  \( downArrow.gif -coalesce -delete 0-7 \) \
  -gravity Northwest -compose over -layers composite \
  null: \
  \( leftArrow.gif -coalesce \) \
  -gravity SouthEast -compose over -layers composite \
  -layers Optimize \
  x.gif
You can see I have removed the first 8 frames from down arrow.

Another possibility:

Code: Select all

convert \
  toes.png \
  null: \
  \( downArrow.gif -coalesce -delete 0,2,4,6,8,10,12,14 +write info: \) \
  -gravity Northwest -compose over -layers composite \
  null: \
  \( leftArrow.gif -coalesce +write info: \) \
  -gravity SouthEast -compose over -layers composite \
  -layers Optimize \
  x2.gif
This removes every other frame from down arrow until 8 frames are removed. The result is smoother than the previous one.

Re: Animated gif images onto static image; undesired results

Posted: 2019-02-21T16:33:57-07:00
by Don
Thank you to both especially snibgo as I'll look into the above code. Much appreciation.