Connect gif-animation, and JPG/PNG

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
sisoev
Posts: 1
Joined: 2012-12-28T17:05:46-07:00
Authentication code: 6789

Connect gif-animation, and JPG/PNG

Post by sisoev »

Hi!
There was a challenge to combine gif-animation and static image JPG or PNG (Impose hyphae-animated background).
I do so:

convert 2.gif -coalesce -set dispose previous 2_tmp.gif - get rid of the artifacts
convert 2_tmp.gif +adjoin tmp/gifs.png - split gif into frames
* further processes each frame separately *
convert -loop 0 tmp/*.png result.gif - collect in animation

But unfortunately the speed is very slow, there may be a simpler solution?
Thank you!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Connect gif-animation, and JPG/PNG

Post by fmw42 »

Creating gifs in IM takes a long time as IM uses a very precise algorithm. To speed it up, you can set -treedepth to 3 or 4 ( I think it is nominally 8 ).


You should be able to combine your first two lines as

convert 2.gif -coalesce -set dispose previous +adjoin tmp/gifs.png

That should avoid creating new gifs until the end.
Post Reply