Function

CGImageSourceCreateThumbnailAtIndex(_:_:_:)

Creates a thumbnail image of the image located at a specified location in an image source.

Declaration

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

Parameters

isrc

An image source.

index

The index that specifies the location of the image. The index is zero-based.

options

A dictionary that specifies additional creation options. See Image Source Option Dictionary Keys for the keys you can supply.

Return Value

A CGImage object. You are responsible for releasing this object using CGImageRelease.

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

Creating Images From an Image Source

func CGImageSourceCreateImageAtIndex(CGImageSource, Int, CFDictionary?) -> CGImage?

Creates a CGImage object for the image data associated with the specified index in an image source.