---
title: "CGImageSourceCreateWithDataProvider(_:_:)"
framework: imageio
role: symbol
role_heading: Function
path: "imageio/cgimagesourcecreatewithdataprovider(_:_:)"
---

# CGImageSourceCreateWithDataProvider(_:_:)

Creates an image source that reads data from the specified data provider.

## Declaration

```swift
func CGImageSourceCreateWithDataProvider(_ provider: CGDataProvider, _ options: CFDictionary?) -> CGImageSource?
```

## Parameters

- `provider`: The data provider to read from. For more information on data providers, see doc://com.apple.documentation/documentation/CoreGraphics/CGDataProvider and https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001066.
- `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)
- [CGImageSourceCreateWithData(_:_:)](imageio/cgimagesourcecreatewithdata(_:_:).md)
- [CGImageSourceCreateIncremental(_:)](imageio/cgimagesourcecreateincremental(_:).md)
