---
title: "init(contentType:encodingQuality:)"
framework: testing
role: symbol
role_heading: Initializer
path: "testing/attachableimageformat/init(contenttype:encodingquality:)"
---

# init(contentType:encodingQuality:)

Initialize an instance of this type with the given content type and encoding quality.

## Declaration

```swift
init(contentType: UTType, encodingQuality: Float = 1.0)
```

## Parameters

- `contentType`: The image format to use when encoding images.
- `encodingQuality`: The encoding quality to use when encoding images. For the lowest supported quality, pass 0.0. For the highest supported quality, pass 1.0.

## Discussion

Discussion If the target image format does not support variable-quality encoding, the value of the encodingQuality argument is ignored. If contentType does not conform to UTType.image, the result is undefined.
