---
title: CGImageSource
framework: imageio
role: symbol
role_heading: Class
path: imageio/cgimagesource
---

# CGImageSource

An opaque type that you use to read image data from a URL, data object, or data consumer.

## Declaration

```swift
class CGImageSource
```

## Overview

Overview Use a CGImageSource type to read data efficiently for most image file formats. The image source object manages the data buffers needed to load the image data and performs any operations on that data to turn it into a usable image. For example, it decompresses data stored in a compressed format. You can also use an image source to fetch or create thumbnail images and access metadata stored with the image. Create an image source object from a CFURL, CFData, or CGDataProvider data type. The image source object reads data from the specified type and extracts the image information for you. For more information, see Image I/O Programming Guide.

## Topics

### Creating an Image Source

- [CGImageSourceCreateWithURL(_:_:)](imageio/cgimagesourcecreatewithurl(_:_:).md)
- [CGImageSourceCreateWithData(_:_:)](imageio/cgimagesourcecreatewithdata(_:_:).md)
- [CGImageSourceCreateWithDataProvider(_:_:)](imageio/cgimagesourcecreatewithdataprovider(_:_:).md)
- [CGImageSourceCreateIncremental(_:)](imageio/cgimagesourcecreateincremental(_:).md)

### Extracting Images From an Image Source

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

### Getting Information From an Image Source

- [CGImageSourceGetTypeID()](imageio/cgimagesourcegettypeid().md)
- [CGImageSourceGetType(_:)](imageio/cgimagesourcegettype(_:).md)
- [CGImageSourceCopyTypeIdentifiers()](imageio/cgimagesourcecopytypeidentifiers().md)
- [CGImageSourceGetCount(_:)](imageio/cgimagesourcegetcount(_:).md)
- [CGImageSourceCopyProperties(_:_:)](imageio/cgimagesourcecopyproperties(_:_:).md)
- [CGImageSourceCopyPropertiesAtIndex(_:_:_:)](imageio/cgimagesourcecopypropertiesatindex(_:_:_:).md)
- [CGImageSourceCopyAuxiliaryDataInfoAtIndex(_:_:_:)](imageio/cgimagesourcecopyauxiliarydatainfoatindex(_:_:_:).md)

### Updating an Incremental Image

- [CGImageSourceUpdateData(_:_:_:)](imageio/cgimagesourceupdatedata(_:_:_:).md)
- [CGImageSourceUpdateDataProvider(_:_:_:)](imageio/cgimagesourceupdatedataprovider(_:_:_:).md)

### Getting the Image Status

- [CGImageSourceGetStatus(_:)](imageio/cgimagesourcegetstatus(_:).md)
- [CGImageSourceGetStatusAtIndex(_:_:)](imageio/cgimagesourcegetstatusatindex(_:_:).md)
- [CGImageSourceStatus](imageio/cgimagesourcestatus.md)

### Specifying the Read Options

- [kCGImageSourceTypeIdentifierHint](imageio/kcgimagesourcetypeidentifierhint.md)
- [kCGImageSourceShouldAllowFloat](imageio/kcgimagesourceshouldallowfloat.md)
- [kCGImageSourceShouldCache](imageio/kcgimagesourceshouldcache.md)
- [kCGImageSourceShouldCacheImmediately](imageio/kcgimagesourceshouldcacheimmediately.md)
- [kCGImageSourceCreateThumbnailFromImageIfAbsent](imageio/kcgimagesourcecreatethumbnailfromimageifabsent.md)
- [kCGImageSourceCreateThumbnailFromImageAlways](imageio/kcgimagesourcecreatethumbnailfromimagealways.md)
- [kCGImageSourceThumbnailMaxPixelSize](imageio/kcgimagesourcethumbnailmaxpixelsize.md)
- [kCGImageSourceCreateThumbnailWithTransform](imageio/kcgimagesourcecreatethumbnailwithtransform.md)
- [kCGImageSourceSubsampleFactor](imageio/kcgimagesourcesubsamplefactor.md)

## Relationships

### Conforms To

- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)

## See Also

### Image Management

- [CGImageDestination](imageio/cgimagedestination.md)
