<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ImageIO",
  "identifier" : "/documentation/ImageIO/CGImageSourceCreateWithDataProvider(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Image I/O"
    ],
    "preciseIdentifier" : "c:@F@CGImageSourceCreateWithDataProvider"
  },
  "title" : "CGImageSourceCreateWithDataProvider(_:_:)"
}
-->

# CGImageSourceCreateWithDataProvider(_:_:)

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

```
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 [Quartz 2D Programming Guide](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 [`Specifying the Read Options`](/documentation/ImageIO/CGImageSource#Specifying-the-Read-Options).

## Return Value

An image source. You’re responsible for releasing this type using <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease>.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)