I have uploaded an image to Azure Fileshare using asp.net and vb.net. After uploading a file I am trying to crop the image by using dimensions. I got an error with Illegal characters in path. The code works when the image is in the application's root folder. But it fails when the image is in a file share. I have tried many solutions none of them worked. Please help to resolve this. The following is the code I am using.
Using OriginalImage As SD.Image = SD.Image.FromFile(<Image Url from Azure FileShare with SAS toeken>)
Using bmp As SD.Bitmap = New SD.Bitmap(Width, Height)
bmp.SetResolution(OriginalImage.HorizontalResolution, OriginalImage.VerticalResolution)
Using Graphic As SD.Graphics = SD.Graphics.FromImage(bmp)
Graphic.SmoothingMode = SmoothingMode.AntiAlias
Graphic.InterpolationMode = InterpolationMode.HighQualityBicubic
Graphic.PixelOffsetMode = PixelOffsetMode.HighQuality
Graphic.DrawImage(OriginalImage, New SD.Rectangle(0, 0, Width, Height), X, Y, Width, Height, SD.GraphicsUnit.Pixel)
Dim ms As MemoryStream = New MemoryStream()
bmp.Save(ms, OriginalImage.RawFormat)
Return ms.GetBuffer()
End Using
End Using
End Using
I have tried decoding the URL. Unescape characters in the string. Those didn't work.
Error I am geting "Illegal characters in path" My URL path is as follows
I have tried decode URL I have tried to unescape URL encoding
I need to crop an image which is already uploaded to Azure FileShare. I am using System.Drawing. If any code is to crop using Azure.Storage.Files.Shares namespace directly would be more helpful.