I have a problem with my Images I uploaded as IFormFile in my .net5 API.
When I copy the IFormFile to MemoryStream and convert it to an iIage, the image is rotated whenever it is not landscape.
[HttpPost("Image/Upload")]
public async Task<IActionResult> upload(IFormFile myFile)
{
var memoryStream = new MemoryStream();
await myFile.CopyToAsync(memoryStream);
memoryStream.Position = 0;
var img = Image.FromStream(memoryStream);
return Ok();
}
I upload an image with height: 3000px and width: 2000px. The results from img are height: 2000px and width 300px.
Can someone explain what is wrong here?
Thank you very much.