<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSImage/init(pasteboard:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSImage(im)initWithPasteboard:"
  },
  "title" : "init(pasteboard:)"
}
-->

# init(pasteboard:)

Initializes and returns an image object with data from the specified pasteboard.

```
convenience init?(pasteboard: NSPasteboard)
```

## Parameters

`pasteboard`

The pasteboard containing the image data. The data on the pasteboard can be in any format that macOS supports, including PDF, PICT, EPS, or any number of bitmap data formats.

## Return Value

An initialized `NSImage` object or `nil` if the method cannot create an image from the contents of the pasteboard.

## Discussion

The specified pasteboard should contain a type supported by one of the registered `NSImageRep` subclasses. The table below lists the default pasteboard types and file extensions for several `NSImageRep` subclasses.

|Image representation class|Default pasteboard type |Default file extensions         |
|--------------------------|------------------------|--------------------------------|
|`NSBitmapImageRep`        |`NSTIFFPboardType`      |`tiff`, `gif`, `jpg`, and others|
|`NSPDFImageRep`           |`NSPDFPboardType`       |`pdf`                           |
|`NSEPSImageRep`           |`NSPostscriptPboardType`|`eps`                           |
|`NSPICTImageRep`          |`NSPICTPboardType`      |`pict`                          |

If the specified pasteboard contains the value `NSFilenamesPboardType`, each filename on the pasteboard should have an extension supported by one of the registered `NSImageRep` subclasses. You can use the [`imageUnfilteredFileTypes()`](/documentation/AppKit/NSImageRep/imageUnfilteredFileTypes()) method of a given subclass to obtain the list of supported types for that class.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)