---
title: "CGImageSourceGetPrimaryImageIndex(_:)"
framework: imageio
role: symbol
role_heading: Function
path: "imageio/cgimagesourcegetprimaryimageindex(_:)"
---

# CGImageSourceGetPrimaryImageIndex(_:)

Returns the index of the primary image for an High Efficiency Image File Format (HEIF) image.

## Declaration

```swift
func CGImageSourceGetPrimaryImageIndex(_ isrc: CGImageSource) -> Int
```

## Parameters

- `isrc`: The image source that contains the image data.

## Return Value

Return Value The index of the primary image, or 0 for image formats other than the HEIF format.

## See Also

### Extracting Images From an Image Source

- [CGImageSourceCreateImageAtIndex(_:_:_:)](imageio/cgimagesourcecreateimageatindex(_:_:_:).md)
- [CGImageSourceCreateThumbnailAtIndex(_:_:_:)](imageio/cgimagesourcecreatethumbnailatindex(_:_:_:).md)
