<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 10.2.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "VideoToolbox",
  "identifier" : "/documentation/VideoToolbox/VTCreateCGImageFromCVPixelBuffer(_:options:imageOut:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Video Toolbox"
    ],
    "preciseIdentifier" : "c:@F@VTCreateCGImageFromCVPixelBuffer"
  },
  "title" : "VTCreateCGImageFromCVPixelBuffer(_:options:imageOut:)"
}
-->

# VTCreateCGImageFromCVPixelBuffer(_:options:imageOut:)

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

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

## Parameters

`pixelBuffer`

A pixel buffer to use as the image data source for the <doc://com.apple.documentation/documentation/CoreGraphics/CGImage>.

`options`

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

`imageOut`

Pointer to an address to receive the newly created <doc://com.apple.documentation/documentation/CoreGraphics/CGImage>.

## Discussion

This routine creates a <doc://com.apple.documentation/documentation/CoreGraphics/CGImage> representation of the image data contained in the provided <doc://com.apple.documentation/documentation/CoreVideo/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)