---
title: "canBeCompressed(using:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsbitmapimagerep/canbecompressed(using:)"
---

# canBeCompressed(using:)

Tests whether the bitmap image representation can be compressed by the specified compression scheme.

## Declaration

```swift
func canBeCompressed(using compression: NSBitmapImageRep.TIFFCompression) -> Bool
```

## Parameters

- `compression`: A TIFF compression type. For more information, see the constants in doc://com.apple.appkit/documentation/AppKit/NSBitmapImageRep/TIFFCompression.

## Return Value

Return Value true if the receiver’s data matches compression with this type, false if the data doesn’t match compression or if compression is unsupported.

## Discussion

Discussion This method returns true if the receiver’s data matches compression; for example, if compression is NSBitmapImageRep.TIFFCompression.ccittfax3, then the data must be 1 bit per sample and 1 sample per pixel.

## See Also

### Managing Compression Types

- [getTIFFCompressionTypes(_:count:)](appkit/nsbitmapimagerep/gettiffcompressiontypes(_:count:).md)
- [localizedName(forTIFFCompressionType:)](appkit/nsbitmapimagerep/localizedname(fortiffcompressiontype:).md)
- [setCompression(_:factor:)](appkit/nsbitmapimagerep/setcompression(_:factor:).md)
- [getCompression(_:factor:)](appkit/nsbitmapimagerep/getcompression(_: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)
