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

# init(pathExtension:encodingQuality:)

Construct an instance of this type with the given path extension and encoding quality.

## Declaration

```swift
init?(pathExtension: String, encodingQuality: Float = 1.0)
```

## Parameters

- `pathExtension`: A path extension corresponding to 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 pathExtension does not correspond to a recognized image format, this initializer returns nil: On Apple platforms, the content type corresponding to pathExtension must conform to UTType.image. On Windows, there must be a corresponding subclass of IWICBitmapEncoder registered with Windows Imaging Component.
