467,144 Members | 1,164 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,144 developers. It's quick & easy.

reading an animated gif ...

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
ab****@noemail.nospam

Nov 18 '05 #1
  • viewed: 1980
Share:
2 Replies
Jos
Koen Hoorelbeke wrote:
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.

--

Jos
Nov 18 '05 #2
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/steve...splayimage.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
ab****@noemail.nospam

"Jos" wrote:
Koen Hoorelbeke wrote:
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.

--

Jos

Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by John J. Hughes II | last post: by
4 posts views Thread by Al_C | last post: by
7 posts views Thread by Gary Kaucher | last post: by
4 posts views Thread by Jeff | last post: by
7 posts views Thread by Lemune | last post: by
27 posts views Thread by Phil | last post: by
reply views Thread by helraizer1 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.