---
title: "CGImageSourceCreateWithData(_:_:)"
framework: imageio
role: symbol
role_heading: Function
path: "imageio/cgimagesourcecreatewithdata(_:_:)"
---

# CGImageSourceCreateWithData(_:_:)

Creates an image source that reads from a Core Foundation data object.

## Declaration

```swift
func CGImageSourceCreateWithData(_ data: CFData, _ options: CFDictionary?) -> CGImageSource?
```

## Parameters

- `data`: The data object from which to read. For more information on data objects, see doc://com.apple.documentation/documentation/CoreFoundation/CFData and https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBinaryData/DataObjects.html#//apple_ref/doc/uid/20000171.
- `options`: A dictionary that specifies additional creation options. For a list of possible values, see doc://com.apple.imageio/documentation/ImageIO/CGImageSource#Specifying-the-Read-Options.

## Return Value

Return Value An image source. You’re responsible for releasing this type using CFRelease.

## See Also

### Creating an Image Source

- [CGImageSourceCreateWithURL(_:_:)](imageio/cgimagesourcecreatewithurl(_:_:).md)
- [CGImageSourceCreateWithDataProvider(_:_:)](imageio/cgimagesourcecreatewithdataprovider(_:_:).md)
- [CGImageSourceCreateIncremental(_:)](imageio/cgimagesourcecreateincremental(_:).md)
