Instance Method


Provides the filtered video frame image to AVFoundation for further processing or display.


func finish(with filteredImage: CIImage, context: CIContext?)



A Core Image image representing the output of whatever filters you’ve applied to the source image.


A Core Image context to be used for rendering the output image, or nil to use a default context provided by AVFoundation.


Call this method when your handler block has finished applying filters, passing the outputImage object from the final filter in your filter chain for the filteredImage parameter. The pixel format for this image must be the BGRA8 format (of the kCVPixelFormatType_32BGRA type).

You can pass the sourceImage object to the filteredImage parameter to disable filtering for the current frame.

By default, you can pass nil for the context parameter to use a default rendering context provided by Core Image. In iOS and tvOS, the default context uses the Device RGB color space. In macOS, the default context uses the sRGB color space. AVFoundation automatically uses a GPU-accelerated context if possible. To use a different color space or control other rendering options, pass your own CIContext object instead.

See Also

Returning the Filtered Image

func finish(with: Error)

Notifies AVFoundation that you cannot fulfill the image filtering request.