An object that provides thumbnail or preview images of assets independently of playback.


@interface AVAssetImageGenerator : NSObject


AVAssetImageGenerator uses the default enabled video track(s) to generate images. Generating a single image in isolation can require the decoding of a large number of video frames with complex interdependencies. If you require a series of images, you can achieve far greater efficiency using the asynchronous method, generateCGImagesAsynchronouslyForTimes:completionHandler:, which employs decoding efficiencies similar to those used during playback.

You create an asset generator using initWithAsset: or assetImageGeneratorWithAsset:. These methods may succeed even if the asset possesses no visual tracks at the time of initialization. You can test whether an asset has any tracks with the visual characteristic using the AVAsset class’s method tracksWithMediaCharacteristic:.

The actual time of a generated image is within the range [requestedTime-requestedTimeToleranceBefore, requestedTime+requestedTimeToleranceAfter] and may differ from the requested time for efficiency.

Assets that represent mutable compositions or mutable movies may gain visual tracks after initialization of an associated image generator.


Creating an Image Generator

- initWithAsset:

Creates an image generator for use with a specified asset.

+ assetImageGeneratorWithAsset:

Returns an image generator for use with a specified asset.

Generating Images

- copyCGImageAtTime:actualTime:error:

Returns an image for the asset at or near a specified time.

- generateCGImagesAsynchronouslyForTimes:completionHandler:

Creates a series of image objects for an asset at or near specified times.


A block that you use to receive thumbnail images generated from an asset.


The statuses indicating the outcome of image generation.

- cancelAllCGImageGeneration

Cancels all pending image generation requests.

Managing Image-Generation Time Tolerances


The maximum amount of time before a requested time you can generate an image.


The maximum length of time after a requested time you can generate an image.

Configuring Image-Generation Behavior


Specifies the aperture mode for the generated image.


The aperture modes used when generating images.


Specifies whether to apply the track matrix, or matrices. when extracting an image from the asset.


The asset that initialized the image generator.


Specifies the maximum dimensions for the generated image.


The video composition to use when extracting images from assets with multiple video tracks.


Returns the custom video compositor instance used, if any.


Inherits From

See Also

File Import


A reader object used to obtain the media data of an asset, either file-based or consisting of an assemblage of media data from multiple sources.


An object that defines an interface for reading audio samples that result from mixing the audio from one or more tracks.


An object that defines an interface for reading media data from a single track of an asset reader's asset.


An object that defines an interface for reading sample references from a single asset track.


An object that reads video frames composited from the frames in one or more tracks of a reader's assets.


An abstract class that defines an interface for reading a single collection of samples of a common media type from an asset reader object.


An object that defines an interface for reading metadata.