Skip to main content

Microsoft Silverlight

Answered Question using animated gif or png sequences in silverlightRSS Feed

(0)

rbunn83815
rbunn83815

Member

Member

156 points

73 Posts

using animated gif or png sequences in silverlight

Hello Everyone,

      Could anyone explain how I can incorporate a gif animation or a png sequence animation in silverlight?  A short snippet of code would be best since for some reason I can't get it to work.  Thanks in advance.

                                                                                           Robert

On the border of insanity and reason lies the realm of genius.

Bill Reiss
Bill Reiss

Contributor

Contributor

4818 points

913 Posts

Silverlight MVP

Re: using animated gif or png sequences in silverlight

I haven't done this, but I've done something that may give you a similar effect. If you have a single png with multiple frames in it, lined up side by side, you can set a clip area in a parent canvas that is the size of a single frame and then set canvas.left on the image so that the appropriate frame is inside the clip area. All of the other frames will be clipped out.


Bill Reiss, Coauthor of Hello! Silverlight 3
My blog (rss feed)

WynApse
WynApse

Star

Star

8111 points

342 Posts

Silverlight MVP

Re: using animated gif or png sequences in silverlight

Hi Robert...

I saw this link this morning from back in April. This is for WPF, but there may be some concepts in this video that would be helpful to you.

http://www.contentpresenter.com/

It's the latest one: "Incorporating PNG Sequences into WPF"

Hope this is useful!

-Dave

Stay in the 'Light
Silverlight MVP
http://www.wynapse.com

rbunn83815
rbunn83815

Member

Member

156 points

73 Posts

Re: using animated gif or png sequences in silverlight

 Yes, this video is where I got the idea to do this, but apparently I don't know everything that is different in silverlight.   Lets try this another way, what would the code be to insert a simple gif image onto your canvas?  Maybe if I can make sure the basics are working all right I can move on.  Thanks in advance.

                                                                                                                                    Robert
 

On the border of insanity and reason lies the realm of genius.

WynApse
WynApse

Star

Star

8111 points

342 Posts

Silverlight MVP
Answered Question

Re: using animated gif or png sequences in silverlight

Hi Robert...

I didn't see this yesterday, my host was experiencing a Denial Of Service attack :(

Inserting an image is pretty straightforward... here's a sample from a live xaml file on my site:

    <Image Source="images/gear_large.png"
      Canvas.Left="75" Canvas.Top="20">

As always, keep asking questions until you get the help you need !

-Dave

Stay in the 'Light
Silverlight MVP
http://www.wynapse.com

heuertk
heuertk

Participant

Participant

1368 points

422 Posts

MicrosoftModerator
Answered Question

Re: using animated gif or png sequences in silverlight

GIFs are not supported in current silverlight builds and sequences in PNG i don't think are rendered as sequences...but definitely no GIFs

-th
http://timheuer.com/blog/

-----

If this answered your question, please be sure to click the 'mark as answered' feature, otherwise please feel free to post follow-up questions that are related.

WynApse
WynApse

Star

Star

8111 points

342 Posts

Silverlight MVP

Re: using animated gif or png sequences in silverlight

Well alrighty then... I could swear I saw somewhere that in the Beta 01 GIFs were usable, so I tried... sorry Tim.. had to try :)

Of course it didn't work... but you'll notice my snippet used a PNG :) ... and I didn't even know PNGs could HAVE sequences... lol

Stay in the 'Light
Silverlight MVP
http://www.wynapse.com

swirlingmass
swirling...

Participant

Participant

1348 points

385 Posts

Re: using animated gif or png sequences in silverlight

You're not imagining things.  From http://msdn2.microsoft.com/en-us/library/bb188343.aspx, "The Source property can be used to display an images, such as GIF, JPG, and PNG format files."

rbunn83815
rbunn83815

Member

Member

156 points

73 Posts

Re: Re: using animated gif or png sequences in silverlight

Okay, all this information is great, but now I am lost on what the answer to the question is.  Could someone please clarify what the answer is for me?  Thanks for helping everyone.

                                                                     Robert

On the border of insanity and reason lies the realm of genius.

WynApse
WynApse

Star

Star

8111 points

342 Posts

Silverlight MVP
Answered Question

Re: Re: using animated gif or png sequences in silverlight

Hi Robert...

Even though the online docs say you can use a gif, I tried one and it doesn't work.

I started using PNG with WPF/E CTP, and have just continued that.

My couple lines of code above work correctly for a png file, but it won't display a PNG that has multiple images... if it will display one of them would have to be tested.

Animating a bunch of individual PNGs would be a code issue and that's what the link to the video was all about, although it is for WPF, it might prove useful.

I think that's it.. :)

Keep asking questions though...

-Dave

Stay in the 'Light
Silverlight MVP
http://www.wynapse.com

rbunn83815
rbunn83815

Member

Member

156 points

73 Posts

Re: Re: Re: using animated gif or png sequences in silverlight

 Okay then, I am amazed at all the limitations I am finding with Silverlight right now.  But I don't doubt that Microsoft is working hard to remove every limitation they can as we speak.  I guess a little patience and a lot of work-arounds are in order, at least for now.  Thanks for everyones help.  It saves me hours of work trying to debug something that can't work in the first place.

                                                                         Robert
 

On the border of insanity and reason lies the realm of genius.

GearWorld
GearWorld

Participant

Participant

820 points

1,084 Posts

Re: Re: Re: using animated gif or png sequences in silverlight

I'm personaly looking for a way to put animation effect.  You know those like in Valve PORTAL ?

So I could add a transparent animation effect and a video behind !

A video tutorial would be nice to see how this can be achieved.

 

justintoth
justintoth

Member

Member

161 points

106 Posts

Re: Re: Re: Re: using animated gif or png sequences in silverlight

I see the last post was in 2007, is there any update on this in Silverlight 3? I wanted to show a progress animation when doing async operations.

ksleung
ksleung

Contributor

Contributor

5198 points

993 Posts

Re: Re: Re: Re: using animated gif or png sequences in silverlight

Nope.  This is one of those "nice to have, not enough justification to incorporate, but doable as a Codeplex project" project.

neopocott
neopocott

Member

Member

368 points

82 Posts

Re: using animated gif or png sequences in silverlight

Speaking of a codeplex project, there is a .NET Image Tools library that does actually support animated GIF files with Silverlight 3.

There is no release yet but the source code is available and the author is looking for help contributions.

http://imagetools.codeplex.com/

Julien Frelat
Microsoft Client App Dev MVP
Quake in Silverlight - Twitter - Blog (French)
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities