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);
}
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);
}
.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) ;
}
}
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us