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

# tiffRepresentation(using:factor:)

Returns a data object that contains TIFF data with the specified compression settings for all of the image representations in the image.

```
func tiffRepresentation(using comp: NSBitmapImageRep.TIFFCompression, factor: Float) -> Data?
```

## Parameters

`comp`

The type of compression to use. For a list of values, see the constants in `NSBitmapImageRep`.

`factor`

Provides a hint for compression types that implement variable compression ratios. Currently, only JPEG compression uses a compression factor.

## Return Value

A data object containing the TIFF data, or `nil` if the TIFF data could not be created.

## Discussion

You can use the returned data object to write the TIFF data to a file. If the specified compression isn’t applicable, no compression is used. If a problem is encountered during generation of the TIFF data, this method may raise an exception.

If one of the receiver’s image representations does not support the creation of TIFF data natively (PDF and EPS images, for example), this method creates the TIFF data from that representation’s cached content.

Additional image formats can be saved by using the `NSBitmapImageRep` method [`representation(using:properties:)`](/documentation/AppKit/NSBitmapImageRep/representation(using:properties:)).

## See Also

[`-  representationUsingType:properties:`](/documentation/AppKit/NSBitmapImageRep/representation(using:properties:))

Formats the bitmap representation’s image data using the specified storage type and properties and returns it in a data object.

[`-  TIFFRepresentationUsingCompression:factor:`](/documentation/AppKit/NSBitmapImageRep/tiffRepresentation(using:factor:))

Returns a TIFF representation of the image using the specified compression.

[`TIFFRepresentation`](/documentation/AppKit/NSBitmapImageRep/tiffRepresentation)

A TIFF representation of the bitmap image data.



---

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)