Cropping CIImage
问题 I have a class that takes an UIImage , initializes a CIImage with it like so: workingImage = CIImage.init(image: baseImage!) Then the image is used to cut out 9 neighbouring squares in a 3x3 pattern out of it - in a loop: for x in 0..<3 { for y in 0..<3 { croppingRect = CGRect(x: CGFloat(Double(x) * sideLength + startPointX), y: CGFloat(Double(y) * sideLength + startPointY), width: CGFloat(sideLength), height: CGFloat(sideLength)) let tmpImg = (workingImage?.cropping(to: croppingRect))! } }