---
title: AttachableImageFormat
framework: testing
role: symbol
role_heading: Structure
path: testing/attachableimageformat
---

# AttachableImageFormat

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

## Declaration

```swift
struct AttachableImageFormat
```

## Overview

Overview When you attach an image to a test, you can pass an instance of this type to 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() from the Image I/O framework to determine which formats are supported. On Windows, you can use IWICImagingFactory.CreateComponentEnumerator() to enumerate the available image encoders.

## Topics

### Initializers

- [init(contentType:encodingQuality:)](testing/attachableimageformat/init(contenttype:encodingquality:).md)
- [init(pathExtension:encodingQuality:)](testing/attachableimageformat/init(pathextension:encodingquality:).md)

### Instance Properties

- [contentType](testing/attachableimageformat/contenttype.md)
- [encodingQuality](testing/attachableimageformat/encodingquality.md)

### Type Properties

- [jpeg](testing/attachableimageformat/jpeg.md)
- [png](testing/attachableimageformat/png.md)

### Type Methods

- [jpeg(withEncodingQuality:)](testing/attachableimageformat/jpeg(withencodingquality:).md)

### Default Implementations

- [CustomDebugStringConvertible Implementations](testing/attachableimageformat/customdebugstringconvertible-implementations.md)
- [CustomStringConvertible Implementations](testing/attachableimageformat/customstringconvertible-implementations.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Escapable](swift/escapable.md)
- [Hashable](swift/hashable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)

## See Also

### Attaching images to tests

- [AttachableAsImage](testing/attachableasimage.md)
- [init(_:named:as:sourceLocation:)](testing/attachment/init(_:named:as:sourcelocation:).md)
- [record(_:named:as:sourceLocation:)](testing/attachment/record(_:named:as:sourcelocation:).md)
