I use SixLabors.ImageSharp to resize photo using below code:
https://www.nuget.org/packages/SixLabors.ImageSharp/
ASP .NET Core 5.0
Input photo: 720x960px
Expect output: 248x186px
Actual result: 186x248px
Why width becomes height and vice versa?
using (var stream = new MemoryStream())
{
using var image = Image.Load(bytes);
image.Mutate(x => x
.Resize(new ResizeOptions
{
Mode = ResizeMode.Crop,
Position = AnchorPositionMode.Center,
Size = new Size(248, 186)
})
.BackgroundColor(Color.White));
await image.SaveAsync(stream, new JpegEncoder() { Quality = 85 });
}