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

# canBeCompressed(using:)

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

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

## Parameters

`compression`

A TIFF compression type. For more information, see the constants in [`NSBitmapImageRep.TIFFCompression`](/documentation/AppKit/NSBitmapImageRep/TIFFCompression).

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> if the receiver’s data matches `compression` with this type, <doc://com.apple.documentation/documentation/Swift/false> if the data doesn’t match `compression` or if `compression` is unsupported.

## Discussion

This method returns <doc://com.apple.documentation/documentation/Swift/true> if the receiver’s data matches `compression`; for example, if `compression` is [`NSBitmapImageRep.TIFFCompression.ccittfax3`](/documentation/AppKit/NSBitmapImageRep/TIFFCompression/ccittfax3), then the data must be 1 bit per sample and 1 sample per pixel.

---

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)