---
title: "vImageCVImageFormat_SetColorSpace(_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/vimagecvimageformat_setcolorspace(_:_:)"
---

# vImageCVImageFormat_SetColorSpace(_:_:)

Sets the color space of a Core Video image format.

## Declaration

```swift
func vImageCVImageFormat_SetColorSpace(_ format: vImageCVImageFormat, _ colorspace: CGColorSpace!) -> vImage_Error
```

## Parameters

- `format`: The Core Video image format to update.
- `colorspace`: The new color space for the format.

## Return Value

Return Value kvImageNoError; otherwise, one of the error codes in Data Types and Constants.

## 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.

## See Also

### Related Documentation

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

### Querying and setting the color space

- [vImageCVImageFormat_GetColorSpace(_:)](accelerate/vimagecvimageformat_getcolorspace(_:).md)
