I'm trying to rotate photo with SkiaSharp
to 90 degrees with following code:
public SKBitmap Rotate()
{
var bitmap = SKBitmap.Decode("test.jpg");
using (var surface = new SKCanvas(bitmap))
{
surface.RotateDegrees(90, bitmap.Width / 2, bitmap.Height / 2);
surface.DrawBitmap(bitmap.Copy(), 0, 0);
}
return bitmap;
}
But when I save bitmap to JPEG
file, it has margins both on top and bottom of image.
Original image: https://i.stack.imgur.com/7eY2o.jpg. Rotated image: https://i.stack.imgur.com/IWZTr.jpg.
What am I doing wrong?