diff --git a/src/ImageProcessor/Processors/RotateInside.cs b/src/ImageProcessor/Processors/RotateInside.cs index 05675be31..cd740a981 100644 --- a/src/ImageProcessor/Processors/RotateInside.cs +++ b/src/ImageProcessor/Processors/RotateInside.cs @@ -83,7 +83,7 @@ namespace ImageProcessor.Processors /// The angle in degrees at which to rotate the image. /// The image rotated to the given angle at the given position. /// - /// Based on + /// Based on the Rotate effect /// private Bitmap RotateImage(Image image, float rotateAtX, float rotateAtY, float angle) { @@ -91,6 +91,8 @@ namespace ImageProcessor.Processors Bitmap newImage = new Bitmap(image.Width, image.Height); newImage.SetResolution(image.HorizontalResolution, image.VerticalResolution); + float zoom = Imaging.Rotation.ZoomAfterRotation(image.Width, image.Height, angle); + // Make a graphics object from the empty bitmap using (Graphics graphics = Graphics.FromImage(newImage)) { @@ -106,6 +108,9 @@ namespace ImageProcessor.Processors // Rotate the image graphics.RotateTransform(angle); + // Zooms the image to fit the area + graphics.ScaleTransform(zoom, zoom); + // Move the image back graphics.TranslateTransform(-rotateAtX * 2, -rotateAtY * 2);