Instance Method


Creates a Quartz 2D image from a region of a Core Image image object.


func createCGImage(_ image: CIImage, from fromRect: CGRect, format: CIFormat, colorSpace: CGColorSpace?) -> CGImage?



A Core Image image object.


The region of the image to render.


The pixel format of the image.


The color space for the output image. This color space must conform to either the CGColorSpaceModel.rgb or CGColorSpaceModel.monochrome model and be compatible with the specified pixel format.

Return Value

A Quartz 2D image. You are responsible for releasing the returned image when you no longer need it.


Renders a region of an image into a temporary buffer using the context, and then creates and returns a Quartz 2D image with the results.

See Also

Rendering Images

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software