---
title: "init(bitmapImageRep:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nsgraphicscontext/init(bitmapimagerep:)"
---

# init(bitmapImageRep:)

Creates a new graphics context using the specified bitmap image representation object as the context destination.

## Declaration

```swift
init?(bitmapImageRep bitmapRep: NSBitmapImageRep)
```

## Parameters

- `bitmapRep`: The doc://com.apple.appkit/documentation/AppKit/NSBitmapImageRep object to use as the destination.

## Return Value

Return Value The created NSGraphicsContext object, or nil if the object could not be created.

## Discussion

Discussion This method accepts only single plane NSBitmapImageRep instances. It is the equivalent of using init(attributes:) and passing bitmapRep as the value for the dictionary’s destination key.

## See Also

### Creating a Graphics Context

- [init(attributes:)](appkit/nsgraphicscontext/init(attributes:).md)
- [init(cgContext:flipped:)](appkit/nsgraphicscontext/init(cgcontext:flipped:)-9cbad.md)
- [init(window:)](appkit/nsgraphicscontext/init(window:).md)
- [init(graphicsPort:flipped:)](appkit/nsgraphicscontext/init(graphicsport:flipped:).md)
