---
title: "CGImageSourceCreateThumbnailAtIndex(_:_:_:)"
framework: imageio
role: symbol
role_heading: Function
path: "imageio/cgimagesourcecreatethumbnailatindex(_:_:_:)"
---

# CGImageSourceCreateThumbnailAtIndex(_:_:_:)

Creates a thumbnail version of the image at the specified index in an image source.

## Declaration

```swift
func CGImageSourceCreateThumbnailAtIndex(_ 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 are responsible for releasing the returned object using CGImageRelease.

## Discussion

Discussion If the image source is a PDF, this function creates a 72 dpi image of the PDF page specified by the index that you pass. You must, however, pass an options dictionary that contains either the kCGImageSourceCreateThumbnailFromImageIfAbsent or kCGImageSourceCreateThumbnailFromImageAlways keys, with the value of the key set to true.

## See Also

### Extracting Images From an Image Source

- [CGImageSourceCreateImageAtIndex(_:_:_:)](imageio/cgimagesourcecreateimageatindex(_:_:_:).md)
- [CGImageSourceGetPrimaryImageIndex(_:)](imageio/cgimagesourcegetprimaryimageindex(_:).md)
