diff --git a/Sources/Mantis/Extensions/CGImageExtensions.swift b/Sources/Mantis/Extensions/CGImageExtensions.swift index 37facce8..447c1dc9 100644 --- a/Sources/Mantis/Extensions/CGImageExtensions.swift +++ b/Sources/Mantis/Extensions/CGImageExtensions.swift @@ -53,8 +53,8 @@ extension CGImage { } guard let context = CGContext(data: nil, - width: Int(outputSize.width), - height: Int(outputSize.height), + width: Int(round(outputSize.width)), + height: Int(round(outputSize.height)), bitsPerComponent: bitsPerComponent, bytesPerRow: bitmapBytesPerRow, space: colorSpaceRef, diff --git a/Sources/Mantis/Extensions/UIImageExtensions.swift b/Sources/Mantis/Extensions/UIImageExtensions.swift index 4126b217..018bfe60 100644 --- a/Sources/Mantis/Extensions/UIImageExtensions.swift +++ b/Sources/Mantis/Extensions/UIImageExtensions.swift @@ -116,8 +116,8 @@ extension UIImage { let cropSize = cropInfo.cropSize let imageViewSize = cropInfo.imageViewSize - let expectedWidth = floor(size.width / imageViewSize.width * cropSize.width) / zoomScaleX - let expectedHeight = floor(size.height / imageViewSize.height * cropSize.height) / zoomScaleY + let expectedWidth = round((size.width / imageViewSize.width * cropSize.width) / zoomScaleX) + let expectedHeight = round((size.height / imageViewSize.height * cropSize.height) / zoomScaleY) return CGSize(width: expectedWidth, height: expectedHeight) }