reading an animated gif ...

G

Guest

Hi there,

I'm trying to read an animated gif from a url (for a banner-rotator). The
code I have now, does read the gif (or jpg), but the result is that I only
get the first frame of the animated gif, AND at a much lower quality :-(

Important to note is that the image is read from a url (from a different
server), and thus NOT from the local disk.

Below is the code I use:

//col[0] = the redirect-url
//col[1] = the image-url

string url = col[1].ToString();
WebClient wc = new WebClient();
Stream st = wc.OpenRead(url);
Bitmap bm = new Bitmap(st);

try
{
HttpResponse response = HttpContext.Current.Response ;
response.ClearContent();
response.ContentType = "image/GIF";
bm.Save(response.OutputStream, ImageFormat.Gif);
}
catch (Exception j)
{
Response.Write(j.Message);
}
st.Close();

What am I doing wrong ? Where should I alter it?

Any help is highly appreciated !!!

Tx in advance.

Greetingz,
Koen Hoorelbeke
(e-mail address removed)
 
J

Jos

Koen said:
Hi there,

I'm trying to read an animated gif from a url (for a banner-rotator).
The code I have now, does read the gif (or jpg), but the result is
that I only get the first frame of the animated gif, AND at a much
lower quality :-(
<snip>

GDI+ does not support animated gifs (yet). Neither does it support
transparent gifs.
I think that even in ASP.NET 2.0, animated gif support will still be
missing.
 
G

Guest

It must be possible though! I saw an article where they did it, but the big
difference was that they read the animated gif from disk, and not from a url
....

The article can be found at
http://authors.aspalliance.com/stevesmith/articles/displayimage.asp
In that article they make a clear distinction between the version that only
reads the first frame and the one that reads them all (as it should be).

I just can't figure out how I should change my code to make it work ...

Any help?

Greetingz,
Koen Hoorelbeke
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top