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

# representation(using:properties:)

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

```
func representation(using storageType: NSBitmapImageRep.FileType, properties: [NSBitmapImageRep.PropertyKey : Any]) -> Data?
```

## Parameters

`storageType`

A constant that specifies a file type for bitmap images. It can be [`NSBMPFileType`](/documentation/AppKit/NSBMPFileType), [`NSGIFFileType`](/documentation/AppKit/NSGIFFileType), [`NSJPEGFileType`](/documentation/AppKit/NSJPEGFileType), [`NSPNGFileType`](/documentation/AppKit/NSPNGFileType), or [`NSTIFFFileType`](/documentation/AppKit/NSTIFFFileType).

`properties`

A dictionary that contains key-value pairs specifying image properties. These string constants used as keys and the valid values are described in [`NSBitmapImageRep.PropertyKey`](/documentation/AppKit/NSBitmapImageRep/PropertyKey).

## Return Value

A data object containing the receiver’s image data in the specified format. You can write this data to a file or use it to create a new [`NSBitmapImageRep`](/documentation/AppKit/NSBitmapImageRep) object.

## See Also

[`tiffRepresentation(using:factor:)`](/documentation/AppKit/NSImage/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.

[`tiffRepresentation`](/documentation/AppKit/NSImage/tiffRepresentation)

A data object containing TIFF data for all of the image representations in the image.



---

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)