Jump to content
  • Advertisement
Sign in to follow this  

importing a GIF to use with XNA

This topic is 2777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm working on a game with a friend and he had made some good looking GIFs to use as character sprites. I've seen that others have used GIFs with XNA before so I'm sure it's possible. I'm new to both C# sharp and XNA (and the IDE) and I've found this link to a library that allows the importing of GIFs to XNA:


I was hoping someone could explain how to set it up because I'm afraid that I'll ruin my game by deleting a necessary file.

Thanks in advance!

Share this post

Link to post
Share on other sites
From what i can see its pretty straight forward. From what i see from the downloaded source code:

1. Add both projects "GifAnimation" and "GifAnimation.Pipeline" to your solution.

2. add to your game project the reference to GifAnimation and to the content project.

3. In the content projection, in your .gif image you set the content processor and inporter to the Gif animation ones.

4. In your code you just have to add the variable
GifAnimation.[color=#2b91af]GifAnimation anim;
5. in the Load content method you add
anim = Content.Load<GifAnimation.[color=#2b91af]GifAnimation>([color=#a31515]"anim1");
6. You have to update the animation in the update Method:
7. Finally when you want to draw, you draw it using the method, you get the animation texture using anim.GetTexture().
spriteBatch.Draw(anim.GetTexture(), [color=blue]new [color=#2b91af]Rectangle(0, 0, 300, 300), [color=#2b91af]Color.White);

seems simple, yet i would advice you to use spritesheet based animations instead as they are more flexible, even if more trick to create from scratch.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!