---
title: "init(CGImage:)"
framework: intents
role: symbol
role_heading: Initializer
path: "intents/inimage/init(cgimage:)"
---

# init(CGImage:)

Creates an image object from the specified Core Graphics image.

## Declaration

```swift
convenience init(CGImage imageRef: CGImage)
```

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

## Parameters

- `imageRef`: A Core Graphics image that contains the image data to use.

## Return Value

Return Value An image object that contains the specified Core Graphics image, or nil if that image is invalid.

## See Also

### Creating an Image Object

- [init(named:)](intents/inimage/init(named:).md)
- [init(UIImage:)](intents/inimage/init(uiimage:).md)
- [init(imageData:)](intents/inimage/init(imagedata:).md)
- [init(url:)](intents/inimage/init(url:)-8eo3q.md)
- [init(url:width:height:)](intents/inimage/init(url:width:height:)-41ikr.md)
