---
title: "vImageConverter_CreateForCVToCGImageFormat(_:_:_:_:_:)"
framework: accelerate
role: symbol
role_heading: Function
path: "accelerate/vimageconverter_createforcvtocgimageformat(_:_:_:_:_:)"
---

# vImageConverter_CreateForCVToCGImageFormat(_:_:_:_:_:)

Creates a vImage converter that converts a Core Video-formatted image to a Core Graphics-formatted image.

## Declaration

```swift
func vImageConverter_CreateForCVToCGImageFormat(_ srcFormat: vImageCVImageFormat, _ destFormat: UnsafePointer<vImage_CGImageFormat>, _ backgroundColor: UnsafePointer<CGFloat>!, _ flags: vImage_Flags, _ error: UnsafeMutablePointer<vImage_Error>!) -> Unmanaged<vImageConverter>!
```

## Parameters

- `srcFormat`: The doc://com.apple.accelerate/documentation/Accelerate/vImageCVImageFormat structure that describes the pixel format associated with the source image buffers.
- `destFormat`: The doc://com.apple.accelerate/documentation/Accelerate/vImage_CGImageFormat structure that describes the pixel format associated with the destination buffers.
- `backgroundColor`: In cases where the source format has an alpha channel and the destination doesn’t (or is doc://com.apple.documentation/documentation/CoreGraphics/CGImageAlphaInfo/noneSkipFirst or doc://com.apple.documentation/documentation/CoreGraphics/CGImageAlphaInfo/noneSkipLast) the conversion removes the alpha channel by flattening it against an opaque background color. The background color is specified as three doc://com.apple.documentation/documentation/CoreFoundation/CGFloat-swift.struct values corresponding to red, green, and blue in sRGB.
- `flags`: The options to use when performing this operation. The following flags are supported: | | | |

## Return Value

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

## Discussion

Discussion This function creates a vImageConverter instance that’s used with vImageConvert_AnyToAny(_:_:_:_:_:) to convert a Core Video formatted image, described by vImageCVImageFormat, to Core Graphics image data, described by vImage_CGImageFormat.

## See Also

### Creating a converter

- [vImageConverter](accelerate/vimageconverter.md)
- [vImageConverter_CreateWithCGImageFormat(_:_:_:_:_:)](accelerate/vimageconverter_createwithcgimageformat(_:_:_:_:_:).md)
- [vImageConverter_CreateWithCGColorConversionInfo(_:_:_:_:_:_:)](accelerate/vimageconverter_createwithcgcolorconversioninfo(_:_:_:_:_:_:).md)
- [vImageConverter_CreateForCGToCVImageFormat(_:_:_:_:_:)](accelerate/vimageconverter_createforcgtocvimageformat(_:_:_:_:_:).md)
- [vImageConverter_CreateWithColorSyncCodeFragment(_:_:_:_:_:_:)](accelerate/vimageconverter_createwithcolorsynccodefragment(_:_:_:_:_:_:).md)
