Reputation: 1208
I have a camera view and top of that I placed one blue rectangle line imageview.
My Questions is, when I press the capture button I have to save the image whatever is inside the rectangle area. I tried with below mentioned code but it doesn't crop that area.
let cgImage = image.cgImage
let croppedCGImage: CGImage = cgImage!.cropping(to: self.m_TrimArea.frame)!
let uiImage = UIImage(cgImage: croppedCGImage)
Here self.m_TrimArea is an imageview which holds the blue rectangle line. Please give some guidance to achieve this.
Upvotes: 0
Views: 2877
Reputation: 554
I would suggest you use the following pod. https://cocoapods.org/pods/Toucan
Upvotes: 1