<!--
{
  "availability" : [
    "macOS: 10.9.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSImage/draw(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSImage(im)drawInRect:"
  },
  "title" : "draw(in:)"
}
-->

# draw(in:)

Draws the image in the specified rectangle.

```
func draw(in rect: NSRect)
```

## Parameters

`rect`

The rectangle in which to draw the image, specified in the current coordinate system.

## Discussion

This method draws the entire image in the specified rectangle, scaling the image as needed. The method composites the image using the [`NSCompositeSourceOver`](/documentation/AppKit/NSCompositeSourceOver) operation

---

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)