Geeks With Blogs

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

Lorin Thwaits A geek says what?

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.

Posted on Monday, November 21, 2005 11:07 AM | Back to top

Comments on this post: All Things Animated GIF

# re: All Things Animated GIF
Requesting Gravatar...
WTF!!!!!!!! weirdo
Left by hiyaded on Oct 17, 2008 4:42 AM

# re: All Things Animated GIF
Requesting Gravatar...
I dont find a free program to get animated GIF's down to usable frames. can you suggest any?
Left by Charlie on May 16, 2009 4:38 PM

# re: All Things Animated GIF
Requesting Gravatar...
Christian Louboutin Shoes Christian Louboutin Shoes
Christian Louboutin Boots Christian Louboutin Boots
Left by jcjc762 on Apr 01, 2010 2:44 AM

# re: All Things Animated GIF
Requesting Gravatar...
thanks for your post!you are really such a nice man!
Left by designerhandbags888 on Apr 10, 2010 2:22 AM

Your comment:
 (will show your gravatar)

Copyright © Lorin Thwaits | Powered by: