Contents

VTCreateCGImageFromCVPixelBuffer(_:options:imageOut:)

Creates a Core Graphics bitmap image or image mask using the provided pixel buffer.

Declaration

func VTCreateCGImageFromCVPixelBuffer(_ pixelBuffer: CVPixelBuffer, options: CFDictionary?, imageOut: UnsafeMutablePointer<CGImage?>) -> OSStatus

Parameters

  • pixelBuffer:

    A pixel buffer to use as the image data source for the Cgimage.

  • options:

    No options are currently supported. Pass NULL for this argument.

  • imageOut:

    Pointer to an address to receive the newly created Cgimage.

Discussion

This routine creates a CGImage representation of the image data contained in the provided CVPixelBuffer. The source CVPixelBuffer may be retained for the lifetime of the CGImage. Changes to the CVPixelBuffer after making this call (other than releasing it) will have undefined results.

Not all CVPixelBuffer pixel formats support conversion into a CGImage-compatible pixel format.