Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# how-to-download-image-from-url

using (WebClient webClient = new WebClient()){
	byte[] dataArr = webClient.DownloadData("url.jpg");
	//save file to local
  	File.WriteAllBytes(@"path.png", dataArr);
}
Comment

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);
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: how to disable and enable rigidbody unity 
Csharp :: c# write all bytes to a file 
Csharp :: check if process is open c# 
Csharp :: unity foreach dictionary 
Csharp :: c# new line in messagebox 
Csharp :: how to download file from url using c# 
Csharp :: unity access child 
Csharp :: random bool c# 
Csharp :: how to get the startup path in console app 
Csharp :: c# boilerplate 
Csharp :: c# executable directory 
Csharp :: unity movetowards 
Csharp :: add two numbers in c# 
Csharp :: create new gameobject unity 
Csharp :: how to change the title of the console in c# 
Csharp :: c# remove non-alphanumeric characters from string 
Csharp :: unity inspector how to get larger field for string text 
Csharp :: unity rotate gameobject 90 degrees 
Csharp :: get date from file c# 
Csharp :: c# round number down 
Csharp :: c# unity camera follow player horizontal axis 
Csharp :: OnCollision update unity 
Csharp :: how to create a rounded custom panel c# 
Csharp :: linq select count group by c# 
Csharp :: unity find closest point on line 
Csharp :: unity google play games plugin spam 
Csharp :: unity detect if version is a build or in editor 
Csharp :: how to stop player rotating when hit by object 
Csharp :: c# get calling method name 
Csharp :: removing illlegal char from filename 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =