How do I get the below code to read from a cloud URL, as opposed to a local file path (stored on a hard drive)?
string imageFilePathUrl = GetImageFilePathUrlFromAzureBlob();
using (Image<Rgba32> image = Image.Load<Rgba32>(imageFilePathUrl))
{
//Resize the loaded image URL...
}
I don't see an Image.Load
overload that takes a URL string (https://docs.sixlabors.com/api/ImageSharp/SixLabors.ImageSharp.Image.html#SixLabors_ImageSharp_Image_Load_System_String_). It will interpret the string as a file path, which it isn't.
You must download the image first, as it's not stored locally. You can use some Azure's storage client, or just download it with a HttpRequest. The easiest way would be with Flurl (https://flurl.dev/):
using Flurl;
using Flurl.Http;
string imageFilePathUrl = GetImageFilePathUrlFromAzureBlob();
Stream stream = await imageFilePathUrl.GetStreamAsync();
using (Image<Rgba32> image = Image.Load<Rgba32>(stream))
{
//Resize the loaded image URL...
}