Home > DeveloperSection > Forums > Download image from URL in C#
Madam Walker
Madam Walker

Total Post:22

Points:154
Posted on    October-05-2013 7:44 AM

 C# C# 
Ratings:


 2 Reply(s)
 1418  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?



Ida B Wells
Ida B Wells

Total Post:30

Points:210
Posted on    October-05-2013 9:00 AM

You should be use using System.Drawing;


Donna Klinton
Donna Klinton

Total Post:3

Points:21
Posted on    October-21-2013 9:09 PM

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.

Don't want to miss updates? Please click the below button!

Follow MindStick