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: http://imgur.com/pGAuko8. Rotated image: http://imgur.com/bYxpmI7.
What am I doing wrong?
See Question&Answers more detail:os