Page 1 of 1

Create Animated Gif with MagickNET

Posted: 2009-01-09T03:18:22-07:00
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