<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 8.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vImageCVImageFormat_GetColorSpace(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "c:@F@vImageCVImageFormat_GetColorSpace"
  },
  "title" : "vImageCVImageFormat_GetColorSpace(_:)"
}
-->

# vImageCVImageFormat_GetColorSpace(_:)

Returns the color space of a Core Video image format.

```
func vImageCVImageFormat_GetColorSpace(_ format: vImageConstCVImageFormat) -> Unmanaged<CGColorSpace>!
```

## Parameters

`format`

The Core Video image format to query.

## Return Value

The color space of the specified image format.

## Discussion

For RGB, indexed, and grayscale images, the color space of a Core Video image format describes the image encoding.

For YpCbCr images, the color space describes the image encoding of the RGB image that’s the result of unapplying the RGB-to-YpCbCr conversion matrix.

The functions that create Core Video image formats, such as [`vImageCVImageFormat_CreateWithCVPixelBuffer(_:)`](/documentation/Accelerate/vImageCVImageFormat_CreateWithCVPixelBuffer(_:)), return a [`vImageCVImageFormat`](/documentation/Accelerate/vImageCVImageFormat). The following code shows how you create a [`vImageConstCVImageFormat`](/documentation/Accelerate/vImageConstCVImageFormat) representation of a [`vImageCVImageFormat`](/documentation/Accelerate/vImageCVImageFormat) instance to pass to [`vImageCVImageFormat_GetColorSpace(_:)`](/documentation/Accelerate/vImageCVImageFormat_GetColorSpace(_:)):

```swift
let colorSpace = withUnsafeBytes(of: cvImageFormat) { bytes in
    let format = bytes.assumingMemoryBound(
        to: vImageConstCVImageFormat.self).first!
    
    return vImageCVImageFormat_GetColorSpace(format)
}
```

## See Also

[`colorSpace`](/documentation/Accelerate/vImageCVImageFormat/colorSpace)

The color space of the Core Video image 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)