Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I generate GIF images in .NET?

Is there a .NET library I can use to programmatically generate my own GIF images?

At a minimum I'd like to build it pixel-by-pixel. Better would be support for text and shapes.

Here's an example of what I'm trying to do. I mocked this up in Photoshop…

Number line graphic http://img143.imageshack.us/img143/5458/dollarlineot9.gif

What do you recommend?

like image 455
Zack Peterson Avatar asked Dec 08 '08 18:12

Zack Peterson


1 Answers

Bitmap bmp = new Bitmap(xSize, ySize, PixelFormat.Format32bppArgb);
using (Graphics g = Graphics.FromImage(bmp)) {
  // Use g and/or bmp to set pixels, draw lines, show text, etc...
}
bmp.Save(filename, ImageFormat.Gif);

Job done

like image 98
Chris Avatar answered Sep 26 '22 13:09

Chris