CGImage of UIImage return NULL

后端 未结 5 728
情深已故
情深已故 2021-01-12 05:16

I created a function for splitting an image into multiple images, but when I take take the CGImage of the UIImage, the CGImage returns NULL

NSArray* splitIma         


        
5条回答
  •  梦谈多话
    2021-01-12 05:36

    Convert CGImage to UIImage with this and cgImage will not be null:

    func convert(cmage:CIImage) -> UIImage
    {       
        let context:CIContext = CIContext.init(options: nil)
        let cgImage:CGImage = context.createCGImage(cmage, from: cmage.extent)!        
        let image:UIImage = UIImage.init(cgImage: cgImage)        
        return image
    }
    

提交回复
热议问题