Converting a large CIImage to CGImage is rendered white

321 Views Asked by At

I am attempting to convert an image to black and white with a filter. Everthing works fine when the image is smaller but when the image is bigger renders fully white. Heres an example of the code without the filter

This code also works when I run it on an iPad but not on an iPhone 6s (ios14)

 let ciImage = CIImage(image: image)!
 let ciContext = CIContext()
 let extent = ciImage.extent
 let cgImage = ciContext.createCGImage(ciImage, from: extent)
 UIImageWriteToSavedPhotosAlbum(UIImage(cgImage: cgImage!), self, nil, nil)

extent has a width 2000 and a height of 6297 in this case.

If I write the image to the library before the conversion I can see it clearly.

My question is why is my image coming out blank and how can I fix it?

0

There are 0 best solutions below