---
title: "init(cgImage:size:device:)"
framework: Touch Controller
role: symbol
role_heading: Initializer
platforms: [iOS 26.0+, iPadOS 26.0+, Mac Catalyst 26.0+]
path: "touchcontroller/tccontrolimage/init(cgimage:size:device:)-22z05"
---

# init(cgImage:size:device:)

Creates a new image from a CGImage.

## Declaration

```swift
convenience init?(cgImage: CGImage, size: CGSize, device: any MTLDevice)
```

## Parameters

- `cgImage`: The Core Graphics image to create the texture from.
- `size`: The size of the image in points.
- `device`: The Metal device used to create the texture.

## Return Value

Return Value A new TCControlImage instance, or nil if texture creation fails.

## See Also

### Creating a control image

- [init(texture:size:)](touchcontroller/tccontrolimage/init(texture:size:).md)
- [init(texture:size:highlight:offset:tintColor:)](touchcontroller/tccontrolimage/init(texture:size:highlight:offset:tintcolor:).md)
- [init(uiImage:size:device:)](touchcontroller/tccontrolimage/init(uiimage:size:device:)-3hqf.md)
