---
title: "init(cgImage:)"
framework: uikit
role: symbol
role_heading: Initializer
path: "uikit/uiimage/init(cgimage:)-14qlb"
---

# init(cgImage:)

Initializes and returns the image object with the specified Quartz image reference.

## Declaration

```swift
init(cgImage: CGImage)
```

## Parameters

- `cgImage`: A Quartz image reference.

## Return Value

Return Value An initialized UIImage object, or nil if the method could not initialize the image from the specified data.

## See Also

### Creating and initializing image objects

- [init(contentsOfFile:)](uikit/uiimage/init(contentsoffile:).md)
- [init(data:)](uikit/uiimage/init(data:).md)
- [init(data:scale:)](uikit/uiimage/init(data:scale:).md)
- [init(cgImage:scale:orientation:)](uikit/uiimage/init(cgimage:scale:orientation:)-2ouhh.md)
- [init(ciImage:)](uikit/uiimage/init(ciimage:)-93vu1.md)
- [init(ciImage:scale:orientation:)](uikit/uiimage/init(ciimage:scale:orientation:)-9gpyn.md)
- [UIImageReader](uikit/uiimagereader-swift.struct.md)
