I try to resize an image but I want to do it in another class library.
When I send this, I get an error which I showed in the screenshots.
I try to resize an image but I want to do it in another class library.
When I send this, I get an error which I showed in the screenshots.
The root cause is read/write permission.
using(var stream= new FileStream(filepath,FileModel.Create)){
await item.CopyToAsync(stream);
// open the orginal image
Image img = Image.FromStream(stream);
// error occurs here, we need to copy and paste it into a new object
// var img2 = new Bitmap(img);
// img2.Save(i2newPath, ImageFormat.Jpeg);
Image newImage = ImageConverterHelper,JPEGConverter(img,filePath)
...
}
For more details, you can check the related issue.
by copying the image internally into a Bitmap instance and saving this image instead of the original image, the error disappeared.