All Things Animated GIF

GIF is the only image format that can present image-based animation in Internet Explorer.  But what level of support does GDI+ offer for animated GIFs?  Well, at least the ability to read individual frames, and in this sample you'll see how to use GDI+ to pick apart an animated GIF.  It is shown here after loading one of the sample images and scrolling to frame 7:

Of interest is the way the WinForms PictureBox control deals with animated GIFs.  Normally it always animates, but in this sample there's a little hack to avoid that.  This is done by writing to the private field “currentlyAnimating“ during every Paint event on the PictureBox so it always presents just the frame you've currently selected, and doesn't continue to animate the whole sequence.

Perhaps in a future version of the framework we'll be able to create animated GIFs, and also control if a PictureBox animates GIFs or not.  At least for now there's some support for GIFs with multiple frames.

You can download the sample here.


Feedback

# re: All Things Animated GIF

WTF!!!!!!!! weirdo 10/17/2008 4:42 AM | hiyaded

Post a comment





 

Please add 4 and 5 and type the answer here:

News


Welcome to my blog.
Here's what we've got on the menu today:

Tag Cloud


Article Categories

Archives

Post Categories

Image Galleries

Syndication: