---
title: "value(forProperty:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsbitmapimagerep/value(forproperty:)"
---

# value(forProperty:)

Returns the value for the specified property.

## Declaration

```swift
func value(forProperty property: NSBitmapImageRep.PropertyKey) -> 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.

## Return Value

Return Value A value specific to property, or nil if the property is not set for the bitmap.

## Discussion

Discussion Image properties can affect how an image is read in and saved to file. When retrieving the bitmap image properties defined in NSBitmapImageRep.PropertyKey, be sure to check the return value of this method for a nil value. If a particular value is not set for the image, this method may return nil.

## 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)
- [setProperty(_:withValue:)](appkit/nsbitmapimagerep/setproperty(_:withvalue:).md)
- [NSBitmapImageRep.TIFFCompression](appkit/nsbitmapimagerep/tiffcompression.md)
- [NSBitmapImageRep.PropertyKey](appkit/nsbitmapimagerep/propertykey.md)
