Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# download image from url

public static bool DownloadImage(string imageUrl, string filename, ImageFormat format)
{    
    WebClient client = new WebClient();
    Stream    stream = client.OpenRead(imageUrl);

    Bitmap bitmap;  
    bitmap = new Bitmap(stream);

    if(bitmap != null)
      bitmap.Save(filename, format);

    stream.Flush();
    stream.Close();
    client.Dispose();

    return File.Exists(filename);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #download #image #url
ADD COMMENT
Topic
Name
3+7 =