I have the below program that converts an image to byte array
public byte[] ReadImageFile(string imageLocation)
{
byte[] imageData = null;
FileInfo fileInfo = new FileInfo(imageLocation);
long imageFileLength = fileInfo.Length;
FileStream fs = new FileStream(imageLocation, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
imageData = br.ReadBytes((int)imageFileLength);
return imageData;
}
If I pass the value as "D:\\ENSource\\1.png"
, it works properly.
But If I send the value as "https://i.stack.imgur.com/PShuQ.png" it throws exception
URI formats are not supported
How can I achieve this?