---
title: "getCompression(_:factor:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsbitmapimagerep/getcompression(_:factor:)"
---

# getCompression(_:factor:)

Returns by indirection the bitmap image representation’s compression type and compression factor.

## Declaration

```swift
func getCompression(_ compression: UnsafeMutablePointer<NSBitmapImageRep.TIFFCompression>?, factor: UnsafeMutablePointer<Float>?)
```

## Parameters

- `compression`: On return, an enum constant that represents the compression type used on the data; it corresponds to one of the values returned by the class method doc://com.apple.appkit/documentation/AppKit/NSBitmapImageRep/getTIFFCompressionTypes(_:count:).
- `factor`: A float value that is specific to the compression type. Many types of compression don’t support varying degrees of compression and thus ignore factor. JPEG compression allows a compression factor ranging from 0.0 to 1.0, with 0.0 being the lowest and 1.0 being the highest.

## Discussion

Discussion Use this method to get information on the compression type for the source image data.

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