<!--
{
  "availability" : [
    "Swift: 6.3.0 -",
    "Xcode: 26.4.0 -",
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "swift: 6.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: -",
    "watchOS: 7.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Testing",
  "identifier" : "/documentation/Testing/AttachableImageFormat",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Swift Testing"
    ],
    "preciseIdentifier" : "s:7Testing21AttachableImageFormatV"
  },
  "title" : "AttachableImageFormat"
}
-->

# AttachableImageFormat

A type describing image formats supported by the system that can be used
when attaching an image to a test.

```
struct AttachableImageFormat
```

## Overview

When you attach an image to a test, you can pass an instance of this type to
[`record(_:named:as:sourceLocation:)`](/documentation/Testing/Attachment/record(_:named:as:sourceLocation:)) so that the testing
library knows the image format you’d like to use. If you don’t pass an
instance of this type, the testing library infers which format to use based
on the attachment’s preferred name.

The testing library always supports the PNG and JPEG image formats. The set
of additional supported image formats is platform-specific:

- On Apple platforms, you can use [`CGImageDestinationCopyTypeIdentifiers()`](https://developer.apple.com/documentation/imageio/cgimagedestinationcopytypeidentifiers())
  from the [Image I/O framework](https://developer.apple.com/documentation/imageio)
  to determine which formats are supported.
- On Windows, you can use [`IWICImagingFactory.CreateComponentEnumerator()`](https://learn.microsoft.com/en-us/windows/win32/api/wincodec/nf-wincodec-iwicimagingfactory-createcomponentenumerator)
  to enumerate the available image encoders.

## Relationships

### Conforms To

[`Copyable`](/documentation/Swift/Copyable)

[`Hashable`](/documentation/Swift/Hashable)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`Equatable`](/documentation/Swift/Equatable)

[`Escapable`](/documentation/Swift/Escapable)

---

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)