Advertise with us

Download image from URL in C#

Posted by  Madam Walker
 2824  View(s)
Rate this:

I know that there are a small amount of similar questions but I have get a problem with the found suggestions.

I tried this:

Image tmpimg = null;

HttpWebRequest _httpWebRequest = (HttpWebRequest)HttpWebRequest.Create(url);
HttpWebResponse _httpWebReponse = (HttpWebResponse)httpWebRequest.GetResponse();
Stream _stream = httpWebReponse.GetResponseStream();
return Image.FromStream(_stream);

But on the last line when I type in Image.  FromStream can´t be found. What can I do?

  1. Re: Download image from URL in C#

    You should be use using System.Drawing;

  1. Re: Download image from URL in C#

    Hi there
    I've tried this code to download image from url:

    using RasterEdge.Imaging.Basic.Core;
    using RasterEdge.Imaging.Basic.Codec;
    using RasterEdge.Imaging.Basic;

    namespace RE__Test
    public partial class Form1 : Form
    public Form1()

    private void button1_Click(object sender, EventArgs e)
    REImage reImage = REFile.GetImageFromURL("", new PNGDecoder());

    REFile.SaveImageFile(reImage, "c:/reimage.png", new PNGEncoder());
    But it failed.What's wrong with my code.