<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSBitmapImageRep/setProperty(_:withValue:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBitmapImageRep(im)setProperty:withValue:"
  },
  "title" : "setProperty(_:withValue:)"
}
-->

# setProperty(_:withValue:)

Sets the specified property of the bitmap image representation to the specified value.

```
func setProperty(_ property: NSBitmapImageRep.PropertyKey, withValue value: Any?)
```

## Parameters

`property`

A string constant used as a key for an image property. These properties are described in [`NSBitmapImageRep.PropertyKey`](/documentation/AppKit/NSBitmapImageRep/PropertyKey).

`value`

A value specific to `property`. If `value` is `nil`, the value of the property is cleared.

## Discussion

The properties can affect how the image is read in and saved to file.

---

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)