DOWNLOAD IMAGE FROM URL IN C#

Madam Walker

Total Post:22

Points:154
Posted by  Madam Walker
C# 
C#
 1857  View(s)
Ratings:
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. Ida B Wells

    Post:30

    Points:210
    Re: Download image from URL in C#

    You should be use using System.Drawing;

  1. Donna Klinton

    Post:3

    Points:21
    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()
    {
    InitializeComponent();
    }

    private void button1_Click(object sender, EventArgs e)
    {
    REImage reImage = REFile.GetImageFromURL("http://www.rasteredge.com/Sample.png", new PNGDecoder());

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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!