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

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.

Related

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.

Glitchiness when I add transparency to a gif and convert it to webm

Starting off I have this gif from google images:
Then I convert the blue to transparency:
convert octopus.gif -transparent "#00AEFF" octopus-transparent.gif
Now I have this (note glitchiness has already started to appear)
Now for the grand finale, I convert it to webm:
convert octopus-transparent.gif tmp%03d.png
ffmpeg -framerate 25 -f image2 -i ./tmp%03d.png -c:v libvpx -pix_fmt yuva420p octopus.webm
See the following screenshot. It is still transparent, but the sizing is no longer steady, and frankly it's starting to look a little creepy:
I don't really know much about video codecs and I've just got this far with others' help. I'd appreciate advice as to how I can change these commands to avoid the glitches.
Your problem may be due to unequal sized frames from an optimization, so add -coalesce to your command, so that it is
convert octopus.gif -coalesce -fuzz 25% -transparent "#00AEEF" miff:- | convert -dispose background - octopus-transparent.gif
If you just want to save as gif again, you can add -layer optimize before saving. But if you want to output to webm, you may need to avoid the -layers optimize.
Also you do not have constant blue color, so you need -fuzz.
The pipe to convert allows one to set the dispose method. It won't work inline in the first convert, since it needs be be set right after reading the input and thus will pickup the blue background rather than the transparent.
What is your IM version? Perhaps you need an upgrade. I get this using IM 6.9.8.3 Q16:

Imagemagick: converting gif to pngs and pngs to gif produce different results

I am getting some problems trying to convert a gif file to pngs (change some colors in the pngs, but not yet) and then reconvert it into gif.
I convert the gif using: convert loading_32.gif loading.png. It produces 11 pngs files, what is pretty fine. But when I am trying to convert these pngs files into gif again using convert -delay 10 -loop 0 *.png loading2.gif , I get a different gif. Here the links to the gifs: original gif and generated gif
Hope someone can help!
This happens because *.png doesn't add the images in the original order. Try the following...
convert -delay 10 -loop 0 loading-{0..11}.png loading2.gif

slide Wipe effects with ImageMagick tool and ffmpeg

I have to do a four slide effects named 'Wipe Up', 'Wipe Down', 'Wipe Right', 'Wipe Left'. Like curtain of two images for each type. I think it can be possible with cropping of images with 'convert'
convert 01.jpg -crop 1920x5 output_%03d.jpg
where i can get sequence of images and compose at same time to the second image(What I don't know..) And then I can build video from this sequence of images with ffmpeg:
ffmpeg -i output_%03d.jpg out.mp4
Maybe someone can help me with compossing of images in the same time when I croping? Thanks for any suggestions!
PS: all images have fixed dimensions: 1920x1080
You could use ImageMagick's MIFF format (Multiple Image File Format) to send a stream of multiple, cropped images to another invocation of ImageMagick to put them together in a video sequence. So assuming you start with this:
and did this
convert input.png -crop 1920x10 miff:- | convert - -loop 0 out.gif
you would get this

Combining 2 png in one with convert

I am using convert from ImageMagick to combine 2 png in one using this script :
convert background.png logo.png -layers merge final_background.png
It is working but I would like to move the logo at 20 pixels from the top, is it possible ?
Thanks a lot
Thierry
I found how to do this :
convert background.png -page +0+130 stationLogo.png -page +0+440 -layers merge Default.png

Resources