qchenqizhi / QCropper

Image cropping/rotating/straightening library for iOS in Swift
MIT License
268 stars 51 forks source link

originalImage.cropped(withCropperState: state) returns original image #15

Closed haib3rl closed 2 years ago

haib3rl commented 2 years ago

image I'm using the code Above to crop an Image. However the method returns the same image.

i receive the following state in the cropperDidConfirm:

(QCropper.CropperState) state = { viewFrame = (origin = (x = 0, y = 0), size = (width = 360, height = 640)) angle = 5.950118308257335 rotationAngle = 0 straightenAngle = -0.33306699892225122 flipAngle = 0 imageOrientationRawValue = (_value = 0) scrollViewTransform = { a = 0.94504405600579122 b = -0.32694301064271586 c = 0.32694301064271586 d = 0.94504405600579122 tx = 0 ty = 0 } scrollViewCenter = (x = 180, y = 226) scrollViewBounds = (origin = (x = 87.666666666666671, y = 0), size = (width = 407.0358613275223, height = 407.03586132752224)) scrollViewContentOffset = (x = 87.666666666666671, y = 0) scrollViewMinimumZoomScale = 1 scrollViewMaximumZoomScale = 20 scrollViewZoomScale = 2.6081443690409132 cropBoxFrame = (origin = (x = 20, y = 110), size = (width = 320, height = 320)) photoTranslation = (x = 214.75151497001622, y = 278.87409146634593) imageViewTransform = { a = 2.6081443690409132 b = 0 c = 0 d = 2.6081443690409132 tx = 0 ty = 0 } imageViewBoundsSize = (width = 309, height = 412) }

haib3rl commented 2 years ago

found the issue. The UIImage I wanted to crop was created from an ciImage therefore the originalImage.cgImage was nil.