---
title: "init(format:)"
framework: avfoundation
role: symbol
role_heading: Initializer
path: "avfoundation/avcapturephotosettings/init(format:)"
---

# init(format:)

Creates a photo settings object with the specified output format.

## Declaration

```swift
convenience init(format: [String : Any]?)
```

## Parameters

- `format`: A dictionary of Core Video pixel buffer attributes or AVFoundation video settings constants (see Video Settings). To capture a photo in an uncompressed format, such as 420f, 420v, or BGRA, set the key doc://com.apple.documentation/documentation/CoreVideo/kCVPixelBufferPixelFormatTypeKey in the format dictionary. The corresponding value must be one of the pixel format identifiers listed in the doc://com.apple.avfoundation/documentation/AVFoundation/AVCapturePhotoOutput/availablePhotoPixelFormatTypes-6eyb array of your photo capture output. To capture a photo in a compressed format, such as JPEG, set the key doc://com.apple.avfoundation/documentation/AVFoundation/AVVideoCodecKey in the format dictionary. The corresponding value must be one of the codec identifiers listed in the doc://com.apple.avfoundation/documentation/AVFoundation/AVCapturePhotoOutput/availablePhotoCodecTypes array of your photo capture output. For a compressed format, you can also specify a compression level with the key doc://com.apple.avfoundation/documentation/AVFoundation/AVVideoQualityKey.

## Mentioned in

Capturing uncompressed image data

## Return Value

Return Value A new photo settings object.

## Discussion

Discussion Requesting capture in a processed format adds requirements for other photo settings: for details, see the format property. The capture output validates these requirements when you call the capturePhoto(with:delegate:) method. If your settings and delegate don’t meet these requirements, that method raises an exception.

## See Also

### Creating photo settings

- [init(rawPixelFormatType:)](avfoundation/avcapturephotosettings/init(rawpixelformattype:).md)
- [init(rawPixelFormatType:processedFormat:)](avfoundation/avcapturephotosettings/init(rawpixelformattype:processedformat:).md)
- [init(rawPixelFormatType:rawFileType:processedFormat:processedFileType:)](avfoundation/avcapturephotosettings/init(rawpixelformattype:rawfiletype:processedformat:processedfiletype:).md)
- [init(from:)](avfoundation/avcapturephotosettings/init(from:).md)
