---
title: "init(_:orientation:)"
framework: foundationmodels
role: symbol
role_heading: Initializer
path: "foundationmodels/attachment/init(_:orientation:)"
---

# init(_:orientation:)

Creates an attachment from a CGImage.

## Declaration

```swift
init(_ cgImage: CGImage, orientation: CGImagePropertyOrientation? = nil)
```

## Parameters

- `cgImage`: The image to attach.
- `orientation`: The orientation to apply to the image. Pass nil to use the image’s natural orientation.

## See Also

### Creating an attachment instance

- [init(imageURL:orientation:)](foundationmodels/attachment/init(imageurl:orientation:).md)
