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

# init(data:)

Initializes a newly allocated bitmap image representation from the specified data.

```
init?(data: Data)
```

## Parameters

`data`

A data object containing image data. The contents of `bitmapData` can be any supported bitmap format. For TIFF data, the [`NSBitmapImageRep`](/documentation/AppKit/NSBitmapImageRep) is initialized from the first header and image data found in `bitmapData`.

## Return Value

Returns an initialized [`NSBitmapImageRep`](/documentation/AppKit/NSBitmapImageRep) if the initialization was successful or `nil` if it was unable to interpret the contents of `bitmapData`.

## Discussion

---

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)