Untitled
Fry
plain_text
10 months ago
632 B
24
Indexable
public async Task<Bitmap> GetBitmapFromUrlAsync(string imageUrl) { using (HttpClient client = new HttpClient()) { try { byte[] imageBytes = await client.GetByteArrayAsync(imageUrl); using (MemoryStream ms = new MemoryStream(imageBytes)) { Bitmap bitmap = new Bitmap(ms); return bitmap; } } catch (Exception ex) { Console.WriteLine($"Error downloading image: {ex.Message}"); return null; } } }
Editor is loading...
Leave a Comment