diff --git a/src/ImageProcessor.UnitTests/Imaging/RotationUnitTests.cs b/src/ImageProcessor.UnitTests/Imaging/RotationUnitTests.cs index 6e71079c6..0e33eb5dc 100644 --- a/src/ImageProcessor.UnitTests/Imaging/RotationUnitTests.cs +++ b/src/ImageProcessor.UnitTests/Imaging/RotationUnitTests.cs @@ -23,6 +23,9 @@ [TestCase(100, 100, 45, 1.41f)] [TestCase(100, 100, 15, 1.22f)] [TestCase(100, 200, 45, 2.12f)] + [TestCase(200, 100, 45, 2.12f)] + [TestCase(600, 450, 20, 1.39f)] + [TestCase(600, 450, 45, 1.64f)] public void RotationZoomIsCalculated(int imageWidth, int imageHeight, float angle, float expected) { float result = Rotation.ZoomAfterRotation(imageWidth, imageHeight, angle); diff --git a/src/ImageProcessor/Imaging/Rotation.cs b/src/ImageProcessor/Imaging/Rotation.cs index b2ecd30cc..421216e00 100644 --- a/src/ImageProcessor/Imaging/Rotation.cs +++ b/src/ImageProcessor/Imaging/Rotation.cs @@ -56,7 +56,7 @@ double widthRotated = (imageWidth * radiansCos) + (imageHeight * radiansSin); double heightRotated = (imageWidth * radiansSin) + (imageHeight * radiansCos); - return (float)(Math.Max(widthRotated, heightRotated) / 100); + return (float)Math.Max(widthRotated / imageWidth, heightRotated / imageHeight); } } } \ No newline at end of file