Domanda

I have some jpg files i want to create gif animated from them. i cant find useful method in gmagick for this problem. any one know about it?

I need simple example for it. ty

È stato utile?

Soluzione

Gmagick example on how to create a GIF picture from two PNG files:

$first = new Gmagick("example.0.png");
$first->setImageformat("gif");
$first->setImageDelay(100);
$second = new Gmagick ("example.1.png");
$first->nextImage();
$first->addImage($second);
$first->previousImage();
$first->write('example.gif');

Example taken from https://bugs.php.net/bug.php?id=59420

Take care that Gmagick internally keeps track at which image you are, that is why nextImage­Docs is used before adding the second image and why previousImage­Docs is used before writing it to disk.

Start with this two picture example and then change it to a version that adds pictures from an array and with three pictures. And then finally read the array from a directory from 0 to N pictures (e.g. with glob). Have fun!

Altri suggerimenti

alone with run the next command be can do

open the terminal of command in linux and write it

convert -delay 25 1.png  2.png 3.png 4.png 5.png 6.png 7.png 8.png 9.png 10.png -loop 0 animate.gif

you can to create the image with inkscape and export to .png .jpg or other format

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top