transition between multiple images with ImageMagick with transitions - image

I am new to ImageMagick, and would naively like to find a command that I can run to create a slideshow from a number of jpeg images with the same fade transition between all images.
I have looked on a number of tutorials / forums, but have only been able to find examples of transitions between 2 images, not 3, 4, or 5 images etc.
I have 5 images (01.jspeg, 02.jpeg, 03.jpeg...etc) that I would like to turn into a slideshow. I would like the slideshow to have the same fade transition between each image. I tried the command line below but it is not behaving as expected!
convert 01.jpeg 02.jpeg 03.jpeg 04.jpeg 05.jpeg -loop 0 morph 9 -set delay "%[fx:(t>0&&t<n-1)?10:320]" output.gif
My presumption of the above code is that a gif would be created of a slideshow of the 5 images with a fade transition between each. but this is not the resulting behaviour.
I am an experienced developer but have no eperience of ImageMagick.
Could someone please let me know what I am misunderstanding about the way that ImageMagic works! Thanks!
I am assuming tha the morph argument provided is applied to all transitions... is this not correct?

I am not sure what you are trying to do with your delay. Perhaps you can explain. But it is not uniform. Many animated gif viewers will not handle delays that change. They works best of a one given delay.
This works fine for me to do a uniform delay using ImageMagick 6.9.10.34 Q16 Mac OSX and viewing it in Safari.
Images:
convert -delay 50 lena.jpg mandril3.jpg zelda1.jpg -morph 9 -loop 0 test.gif
This is what I get from your delay, which starts very slowly and then ends very quickly. Note I put the -set delay right after reading the input and before the -morph. Does that work the way you want in your command?
convert lena.jpg mandril3.jpg zelda1.jpg -set delay "%[fx:(t>0&&t<n-1)?10:320]" -morph 9 -loop 0 test2.gif

Related

How to zoom out image from and to specified dimensions using ffmpeg or python?

I have an image 3600x3600, and I want to start zooming it smoothly, beginning from 1717x1080 size, and by some designed time (f.e. 5 secs) get the size of 3600x2264. This is almost the same ratio as input (0.4 pixel of difference).
I need clean code, just can't find it. There's plenty of not working solutions.
EDIT
According to this topic: FFmpeg zoom not smooth-centered (but zigzag) I tried doing something
ffmpeg -loop 1 -i e:/gals/img.jpg -vf "zoompan=z='min(zoom-0.0320,5)':d=125:x='(iw-(iw/zoom))*(3600/-1883)':y='(ih-(ih/zoom))*(2265/-2520)',scale=1717x1018" -t 5 e:/vid.mp4
But it doesn't work. If I change parameters, I get bad ratio - the whole image of 3.6kx3.6k is stretched to my dimensions.
EDIT 2
Thanks to some other answers I found working code:
ffmpeg -loop 1 -i e:/gals/Esk04.jpg -vf "zoompan=z='if(lte(zoom,1.0),1.8,max(1.001,zoom-0.005))':d=125:x='(iw-(iw/zoom))/2':y='(ih-(ih/zoom))/2'" -t 5 e:/vid.mp4
but it saves the video in 1280x720 dimensions, while I need to save in 1717x1080 without changing image content ratio. Now I only need to crop it and keep the ratio - ideally with one command. Adding -s "1717x1080" causes some errors, depending on other parameters i set.

ImageMagick convert command misses frames

I am using 'convert' to make animated gifs with some png images I have generated.
If these images are small, then all works fine. I did
convert -delay 3 -loop 0 animation-small-png-1/* animation-small-1.gif
The generated gif works, see it with this post, it's the one with the big circle.
But if I take the big images and I do
convert -delay 3 -loop 0 animation-small-png-2/* animation-small-2.gif
Then the generated gif doesn't work fine, see it with this post : it's the one with the little circle, the size of this circle jumps one time by animation cycle. That is not normal, see please the previous gif file.
Can someone help me ?
images 1
images 2
Your Imagemagick command works fine for me on IM 6.9.12-70 Q16 Mac OSX Monterey and libpng 1.6.38
convert -delay 3 animation-small-png-2/* -loop 0 animation-small-2.gif
What is your Imagemagick version and platform/OS? What is your version of libpng? Do you have enough space in your /tmp directory? Are there left-over Imagemagick files there that you can delete?
My guess was that your /tmp directory got too full and could not handle any more files during your processing of the animation.

ImageMagick - convert png(s) to animated gif rather than having separate multiple overlapping images

Confuse as to what I'm doing wrong. I used the following command:
convert -loop 0 -delay 10 dog_cursor_24_1.png dog_cursor_24_2.png dog_cursor_24_3.png, dog_cursor_24_4.png, dog_cursor_24_5.png test.gif
Outputs a GIF image but upon viewing, the images are overlapping each other, which I do not want. Should look like a moving picture.
In Imagemagick, you do not use commas. So remove them. Put -loop 0 before the output gif and add +repage after reading the pngs to remove any virtual canvas.
convert -delay 10 dog_cursor_24_1.png dog_cursor_24_2.png dog_cursor_24_3.png dog_cursor_24_4.png dog_cursor_24_5.png +repage -loop 0 test.gif
If that does not work, then post your animation. It may need a different -dispose method.

Wipe image in and out with ffmpeg / imagemagick

I'd like to create a wipe in/out from left to right effect with ffmpeg and/or ImageMagick that is common to most video editors. (e.g. Adobe Premiere, Final Cut Pro and even OpenShot) Some might call this a slide in/out transition effect.
I found that ffmpeg has a lot of filters (including fades), but none seem to be the correct choice for this.
There are also ImageMagick transitions that achieve a wipe in effect. Like in the following example (that is derived from here):
convert overlay.png -crop 10x1080 miff:- | convert - out.gif
But I found it hard to control the actual speed/duration of the transition. I'd like it to last only 2.5 seconds. But I can't make it that fast, because the -delay 1x30 option doesn't seem to let me decrease the delay that low. There is also a library with ImageMagick transitions here that unfortuantely isn't compatible with batch.
I suppose there is a solution for ffmpeg that I couldn't think of, yet. I'd really appreciate your advice!

How to preserve transparency when using png to make video with ffmpeg

I have a series of png's that have an alpha channel as a background. Each file is named like file_name.0001.png and so on, in subsequent order. I'd like to join these png's into a video with ffmpeg and maintain the transparency.
I've tried a couple of things but I suspect I'm running into a codec issue. When I run ffmpeg, the video is created but the background is black.
If it makes a difference, I'm wanting to use the video in Microsoft Powerpoint. Thanks!
Edit
The suggested duplicate is very close to what I was looking for, thank you! The only reason it's not a complete solution is none of the options presented in the other thread work well with Microsoft Powerpoint. None of the codecs used in the suggested solution play well with Powerpoint. This is not the fault of ffmpeg, but of Powerpoint.
Though ffmpeg doesn't seem to be able to do what I need, I found that imagemagick did the trick. I was able to create a gif from the images and the alpha channel was preserved. I used the following:
convert -dispose 3 -coalesce images.*.png gif_file_name.gif
The -dispose 3 is critical as it tells imagemagick to clear the image prior to overlay, otherwise, you can see each image overlaid on each other (since they have the transparent background).
I couldn't get ffmpeg to create a video that preserved the alpha channel and was Powerpoint friendly (not the fault of ffmpeg). Though ffmpeg doesn't seem to be able to do what I need, I found that imagemagick did the trick. I was able to create a gif from the images and the alpha channel was preserved. I used the following:
convert -dispose 3 -coalesce images.*.png gif_file_name.gif
The -dispose 3 is critical as it tells imagemagick to clear the image prior to overlay, otherwise, you can see each image overlaid on each other (since they have the transparent background).

Resources