---
title: "CGImageSourceCreateImageAtIndex(_:_:_:)"
framework: imageio
role: symbol
role_heading: Function
path: "imageio/cgimagesourcecreateimageatindex(_:_:_:)"
---

# CGImageSourceCreateImageAtIndex(_:_:_:)

Creates an image object from the data at the specified index in an image source.

## Declaration

```swift
func CGImageSourceCreateImageAtIndex(_ isrc: CGImageSource, _ index: Int, _ options: CFDictionary?) -> CGImage?
```

## Parameters

- `isrc`: The image source that contains the image data.
- `index`: The zero-based index of the image you want. If the index is invalid, this method returns NULL.
- `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 The image at the specified index, or NULL if an error occurs. You’re responsible for releasing the returned object using CGImageRelease.

## See Also

### Extracting Images From an Image Source

- [CGImageSourceCreateThumbnailAtIndex(_:_:_:)](imageio/cgimagesourcecreatethumbnailatindex(_:_:_:).md)
- [CGImageSourceGetPrimaryImageIndex(_:)](imageio/cgimagesourcegetprimaryimageindex(_:).md)
