Page view counter
using animated gif or png sequences in silverlight Subscribe to this thread
Last post 06-21-2009 6:03 AM by neopocott. 14 replies.
Sort Posts:
06-17-2007 1:26 AM
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.

rbunn83815

Loading...
Joined on 02-02-2007
Posts 73
06-17-2007 8:17 AM
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 2
My blog (rss feed)

Bill Reiss

Loading...
Joined on 05-01-2007
Tampa, FL
Posts 894
06-19-2007 12:48 PM
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
MVP: Visual Developer - Client Application Development
http://www.wynapse.com
Twitter SLNews | Join me @ SilverlightCream | SL Web Articles | My Articles | My Tutorials | My Tooltips | SilverlightCream

WynApse

Loading...
Joined on 05-13-2004
Posts 341
06-19-2007 4:31 PM
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.

rbunn83815

Loading...
Joined on 02-02-2007
Posts 73
06-22-2007 9:25 AM
Marked as Answer
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
MVP: Visual Developer - Client Application Development
http://www.wynapse.com
Twitter SLNews | Join me @ SilverlightCream | SL Web Articles | My Articles | My Tutorials | My Tooltips | SilverlightCream

WynApse

Loading...
Joined on 05-13-2004
Posts 341
06-22-2007 2:05 PM
Marked as Answer
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.

heuertk

Loading...
Joined on 06-20-2002
Queen Creek, AZ
Posts 400
06-22-2007 2:13 PM
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
MVP: Visual Developer - Client Application Development
http://www.wynapse.com
Twitter SLNews | Join me @ SilverlightCream | SL Web Articles | My Articles | My Tutorials | My Tooltips | SilverlightCream

WynApse

Loading...
Joined on 05-13-2004
Posts 341
06-22-2007 4:11 PM
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."

swirlingmass

Loading...
Joined on 05-02-2007
Posts 385
06-22-2007 4:16 PM
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.

rbunn83815

Loading...
Joined on 02-02-2007
Posts 73
06-22-2007 4:37 PM
Marked as Answer
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
MVP: Visual Developer - Client Application Development
http://www.wynapse.com
Twitter SLNews | Join me @ SilverlightCream | SL Web Articles | My Articles | My Tutorials | My Tooltips | SilverlightCream

WynApse

Loading...
Joined on 05-13-2004
Posts 341
06-22-2007 5:03 PM
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.

rbunn83815

Loading...
Joined on 02-02-2007
Posts 73
10-11-2007 7:33 AM
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.

 

GearWorld

Loading...
Joined on 09-13-2007
Posts 866
06-20-2009 11:50 PM
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.

Justin Toth
Toth Solutions
Justin Toth's Blog

justintoth

Loading...
Joined on 05-14-2009
Cockeysville, MD
Posts 96
06-21-2009 12:04 AM
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.

Visit http://blog.coloroke.com

ksleung

Loading...
Joined on 10-14-2008
San Jose, CA
Posts 593
06-21-2009 6:03 AM
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

InnoveWare Solutions - Quake in Silverlight - Silverlight Underground Blog
Do not forget to mark as answer if I answered your question

neopocott

Loading...
Joined on 08-10-2008
Paris, France
Posts 79
Microsoft Communities