---
title: "vImageCVImageFormat_GetColorSpace(_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/vimagecvimageformat_getcolorspace(_:)"
---

# vImageCVImageFormat_GetColorSpace(_:)

Returns the color space of a Core Video image format.

## Declaration

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

## Parameters

- `format`: The Core Video image format to query.

## Return Value

Return Value The color space of the specified image format.

## Discussion

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(_:), return a vImageCVImageFormat. The following code shows how you create a vImageConstCVImageFormat representation of a vImageCVImageFormat instance to pass to vImageCVImageFormat_GetColorSpace(_:): let colorSpace = withUnsafeBytes(of: cvImageFormat) { bytes in     let format = bytes.assumingMemoryBound(         to: vImageConstCVImageFormat.self).first!          return vImageCVImageFormat_GetColorSpace(format) }

## See Also

### Related Documentation

- [colorSpace](accelerate/vimagecvimageformat/colorspace.md)

### Querying and setting the color space

- [vImageCVImageFormat_SetColorSpace(_:_:)](accelerate/vimagecvimageformat_setcolorspace(_:_:).md)
