Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I create an animated .gif using ImageMagick

Graphics

How can I create an animated .gif using ImageMagick

by  ChrisRChamberlain  Posted    (Edited  )
Until such time as such functionality exists with GdiPlus, the following alternative methodology does provide a way to allow a user or developer to programatically create an animated .gif.

Download and install ImageMagick from http://www.imagemagick.org/script/index.php, making sure the version selected contains the ImageMagickObject.dll. The object will be registered during the installation process.

You will need to study the ImageMagick documentation in depth to fully understand how it works.

The barebones code that follows will create an animated gif.

Note there is no need to use "" with filenames containing spaces.

Code:
[color blue]oIM = CREATEOBJECT([ImageMagickObject.MagickImage.1])

lcFile1 = [C:\pictures\expanded\picture 043.png][/color][color green]&& Fully qualified filename[/color][color blue]
lcFile2 = [C:\pictures\expanded\picture 044.png]
lcFile3 = [C:\pictures\expanded\picture 045.png]
lcDelay = [-delay][/color][color green] && Required otherwise no delay[/color][color blue]
lnDelay = [300][/color][color green] && Change delay value to suit[/color][color blue]
lcAniGif = ADDBS(SYS(5);[/color][color green] && Required output filename[/color][color blue]
	+ SYS(2003));[/color][color green] && with fully qualified path[/color][color blue]	
	+ [output\output.gif]

oIM.Convert(	;
[tab]lcFile1	,;
[tab]lcFile2	,;
[tab]lcFile3	,;
[tab]lcDelay	,;
[tab]lnDelay	,;	
[tab]lcAniGif)

oIM = .NULL.
RELEASE oIM[/color]
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top