Answers for "Download image from url c#"

C#
0

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);
}
Posted by: Guest on December-21-2020
0

.net core download image from url binary file

using (WebClient webClient = new WebClient()) 
{
    byte [] data = webClient.DownloadData("https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/10555140_10201501435212873_1318258071_n.jpg?oh=97ebc03895b7acee9aebbde7d6b002bf&oe=53C9ABB0&__gda__=1405685729_110e04e71d9");

   using (MemoryStream mem = new MemoryStream(data)) 
   {
       using (var yourImage = Image.FromStream(mem)) 
       { 
          // If you want it as Png
           yourImage.Save("path_to_your_file.png", ImageFormat.Png) ; 

          // If you want it as Jpeg
           yourImage.Save("path_to_your_file.jpg", ImageFormat.Jpeg) ; 
       }
   } 

}
Posted by: Guest on May-04-2020
-2

C# download image on url

download image
Posted by: Guest on August-29-2020

Code answers related to "Download image from url c#"

C# Answers by Framework

Browse Popular Code Answers by Language