<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.8.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreVideo",
  "identifier" : "/documentation/CoreVideo/CVImageBufferCreateColorSpaceFromAttachments(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Video"
    ],
    "preciseIdentifier" : "c:@F@CVImageBufferCreateColorSpaceFromAttachments"
  },
  "title" : "CVImageBufferCreateColorSpaceFromAttachments(_:)"
}
-->

# CVImageBufferCreateColorSpaceFromAttachments(_:)

Attempts to create a Core Graphics color space from the image buffer’s attachments that you specify.

```
func CVImageBufferCreateColorSpaceFromAttachments(_ attachments: CFDictionary) -> Unmanaged<CGColorSpace>?
```

## Parameters

`attachments`

The dictionary of attachments for an image buffer, which you can obtain by calling [`CVBufferCopyAttachments(_:_:)`](/documentation/CoreVideo/CVBufferCopyAttachments(_:_:)) on the image buffer.

## Return Value

A <doc://com.apple.documentation/documentation/CoreGraphics/CGColorSpace> object that represents the color space of the image buffer, or <doc://com.apple.documentation/documentation/ObjectiveC/nil-227m0> if the dictionary doesn’t contain the information required to create a <doc://com.apple.documentation/documentation/CoreGraphics/CGColorSpace> instance.

## Discussion

To generate a <doc://com.apple.documentation/documentation/CoreGraphics/CGColorSpace> instance, the attachments dictionary needs to include values for either:

1. [`kCVImageBufferICCProfileKey`](/documentation/CoreVideo/kCVImageBufferICCProfileKey)
2. [`kCVImageBufferColorPrimariesKey`](/documentation/CoreVideo/kCVImageBufferColorPrimariesKey), [`kCVImageBufferTransferFunctionKey`](/documentation/CoreVideo/kCVImageBufferTransferFunctionKey), [`kCVImageBufferYCbCrMatrixKey`](/documentation/CoreVideo/kCVImageBufferYCbCrMatrixKey), and possibly [`kCVImageBufferGammaLevelKey`](/documentation/CoreVideo/kCVImageBufferGammaLevelKey)

Use <doc://com.apple.documentation/documentation/CoreGraphics/CGColorSpaceRelease> to release the color space when you’re done with it.

---

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)