---
title: "setProperty(_:withValue:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsbitmapimagerep/setproperty(_:withvalue:)"
---

# setProperty(_:withValue:)

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

## Declaration

```swift
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 doc://com.apple.appkit/documentation/AppKit/NSBitmapImageRep/PropertyKey.
- `value`: A value specific to property. If value is nil, the value of the property is cleared.

## Discussion

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

## See Also

### Managing Compression Types

- [getTIFFCompressionTypes(_:count:)](appkit/nsbitmapimagerep/gettiffcompressiontypes(_:count:).md)
- [localizedName(forTIFFCompressionType:)](appkit/nsbitmapimagerep/localizedname(fortiffcompressiontype:).md)
- [canBeCompressed(using:)](appkit/nsbitmapimagerep/canbecompressed(using:).md)
- [setCompression(_:factor:)](appkit/nsbitmapimagerep/setcompression(_:factor:).md)
- [getCompression(_:factor:)](appkit/nsbitmapimagerep/getcompression(_:factor:).md)
- [value(forProperty:)](appkit/nsbitmapimagerep/value(forproperty:).md)
- [NSBitmapImageRep.TIFFCompression](appkit/nsbitmapimagerep/tiffcompression.md)
- [NSBitmapImageRep.PropertyKey](appkit/nsbitmapimagerep/propertykey.md)
