Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make a high quality animated image with imagemagick

Tags:

imagemagick

I want to make an animated gif from those .png image:

enter image description hereenter image description hereenter image description hereenter image description here

I do it with this command:

convert -layers OptimizePlus -delay 25x100 ps1-*.png -loop 0 ps1.gif

It made an animated gif successfully, however, the output has very low quality and smaller than input images:

enter image description here

After some search, I got -quality

convert -layers OptimizePlus -delay 25x100 -quality 99 ps1-*.png -loop 0 ps1.gif

But it seems like imagemagick just ignore the parameter.

like image 393
Mee Avatar asked Jan 19 '14 01:01

Mee


People also ask

How do I make a GIF with ImageMagick?

To create an animated GIF image, ImageMagick has another routine that is quite helpful called convert. Although it is possible to convert directly from the PPM images, it is better to use xv to make some smaller GIF images of each frame, and then use the command: convert -delay 20 -loop 0 sphere*. gif animatespheres.


Video Answer


1 Answers

The problem is that your source PNGs have an alpha channel which is not supported by GIFs. So you have to remove transparency from your source images first. Since you're dealing with multiple source images, you can't use the -flatten method. With newer ImageMagick versions the following should work:

convert -background white -alpha remove -layers OptimizePlus -delay 25x100 ps1-*.png -loop 0 ps1.gif

If your version of ImageMagick is older than 6.7.5, you can try:

convert -bordercolor white -border 0 -layers OptimizePlus -delay 25x100 ps1-*.png -loop 0 ps1.gif

I got the following result with the latter command:

animation

like image 91
nwellnhof Avatar answered Oct 22 '22 04:10

nwellnhof