<!--
{
  "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/CGImageSourceCreateWithData(_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Image I/O"
    ],
    "preciseIdentifier" : "c:@F@CGImageSourceCreateWithData"
  },
  "title" : "CGImageSourceCreateWithData(_:_:)"
}
-->

# CGImageSourceCreateWithData(_:_:)

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

```
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 [Data Objects](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 [`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)