Create Animated Gif with MagickNET

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
ravel

Create Animated Gif with MagickNET

Post by ravel »

Hi,

I would like to create an animated gif with magickNET.

I want to use an existing image and place some frames with text on this image like this example: http://img3.imagebanana.com/img/vmqi06u/test.gif

I managed to write a text on an existing image with this piece of code:

C#

Code: Select all

            MagickNet.Magick.Init();
            MagickNet.Image img = new MagickNet.Image("c:\\test.jpg");
            MagickNet.Image imgText = new MagickNet.Image(new MagickNet.Geometry(40, 16), new MagickNet.Color(System.Drawing.Color.Black));            
            imgText.FillColor = new MagickNet.Color(System.Drawing.Color.White);
            imgText.Font = "Arial";
            imgText.FontPointSize = 16;
            //antialias=false otherwise the transparent()-method creates a poor result
            imgText.Antialias = false;
            imgText.Annotate("hello", MagickNet.GravityType.CenterGravity);
            imgText.Transparent(new MagickNet.Color(System.Drawing.Color.Black));            
            img.Composite(imgText, 0, 0, MagickNet.CompositeOperator.AtopCompositeOp);            
            img.Write("c:\\x.gif");
            MagickNet.Magick.Term();
            picBox.Image = MagickNet.Image.ToBitmap(img);
But I don't know how to make an animation. I thought there is some method like img.AddFrame() to enqueue images to create an animated gif.

Any advise?

Thanks in advance,
ravel
Post Reply