combine .png and .gif

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
Mattdk
Posts: 2
Joined: 2015-06-10T11:02:24-07:00
Authentication code: 6789

combine .png and .gif

Post by Mattdk »

Hey everybody,
I would be very pleased if anybody could help.

I am trying to create a new image with two .png and one animated .gif in the middle. So the resulting gif should look like this:

image1.png my_gif.gif image2.png

The images on the left and on the right are fix and the gif in the middle should be animated


I tried with convert and montage but either it does not work at all or it creats a strip consisting of all images (also the 10 images which creates the .gif)


I am very thankfull for your answers!!!
Best Matt
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: combine .png and .gif

Post by snibgo »

An image might be a png, or it might be a gif. It can't be both at once.

You could make a gif where each frame comes from an append of image1.png and a frame from my_gif.gif and image2.png. I'm not sure if that can be done in a single command.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: combine .png and .gif

Post by fmw42 »

I believe that you can combine all the images into a new gif animation. Try something like

Code: Select all

convert \( -delay 500 firstpngimage.png \) \( -delay 20 gifanimation.gif -coalesce \) \( -delay 500 lastpngimage.png \) -loop 0 newgifanimation.gif
Mattdk
Posts: 2
Joined: 2015-06-10T11:02:24-07:00
Authentication code: 6789

Re: combine .png and .gif

Post by Mattdk »

Thanks very much for your advices.
It did not work the way I want it to, but I figured out an other way (a little bit a more time intensive way, but it worked;-) )

I first made my 48 strips:
convert fix_image_1.png frame_1.png fix_image_2.png +append animation_1.png \
convert fix_image_1.png frame_2.png fix_image_2.png +append animation_2.png \ and so on....

then I made the loops to create the animated gif.
convert -delay 10 animation_1.png animation_2.png (.....) -loop 0 endversion.gif
Post Reply