---
title: "init(contentsOf:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nsimage/init(contentsof:)"
---

# init(contentsOf:)

Initializes and returns an image object with the contents of the specified URL.

## Declaration

```swift
convenience init?(contentsOf url: URL)
```

## Parameters

- `url`: The URL identifying the image.

## Return Value

Return Value An initialized NSImage object or nil if the method cannot create an image representation from the contents of the specified URL.

## See Also

### Creating Images from Resource Files

- [init(byReferencingFile:)](appkit/nsimage/init(byreferencingfile:).md)
- [init(byReferencing:)](appkit/nsimage/init(byreferencing:).md)
- [init(contentsOfFile:)](appkit/nsimage/init(contentsoffile:).md)
