Wednesday, August 18, 2010

Url to Image

you want to use any online image source and get GDI Image object over it??

here the way

public Image ImageFromWeb(string URL)
{
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(URL);
myRequest.Method = "GET";
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
Image img = Image.FromStream(myResponse.GetResponseStream());
myResponse.Close();
return img;
}

Alternatively Url to Bitmap solution on the link

http://www.dreamincode.net/code/snippet2555.htm

No comments: