<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.14.0 -",
    "tvOS: 12.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 5.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVPortraitEffectsMatte",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVPortraitEffectsMatte"
  },
  "title" : "AVPortraitEffectsMatte"
}
-->

# AVPortraitEffectsMatte

An auxiliary image used to separate foreground from background with high resolution.

```
class AVPortraitEffectsMatte
```

## Overview

Before iOS 11, the iPhone camera software used depth maps to render a shallow depth of field (the *bokeh* effect) into still images taken in Portrait Mode before discarding the maps. Because the effect was part of the photo, you couldn’t access the maps separately, as metadata, for photos taken by devices running iOS 10 or earlier.

Starting in iOS 11, apps accessing the photo library can use images containing embedded auxiliary depth maps to render creative depth effects, such as forced perspective, or image projection from 2D to 3D space. These depth maps are low-resolution compared to the full-resolution RGB image. As such, the depth effects you can render are limited by the resolution and accuracy of the maps. Fine detail, such as hair, is challenging to preserve faithfully at the resolution of these depth maps.

Starting in iOS 12, the portrait effects matte helps achieve this fine-grain level of detail.

![Zoomed in photo showing the fine detail in a portrait effects matte image](images/com.apple.avfoundation/media-3030223@2x.png)

|**Camera type** |**RGB image resolution**|**Depth map resolution**|**Portrait effects matte resolution**|
|----------------|------------------------|------------------------|-------------------------------------|
|Rear dual camera|4032 x 3024             |768 x 576               |2016 x 1512                          |
|TrueDepth camera|3088 x 2320             |640 x 480               |1544 x 1160                          |

Using the auxiliary matte image, you can improve the quality of rendered portrait effects, such as Natural Light, Studio Light, Contour Light, Stage Light, and Stage Light Mono.

Unlike the depth map, the portrait effects matte isn’t intended to faithfully preserve all gradations of depth in the scene. It’s a depth-guided, people-focused segmentation mask generated from a proprietary Apple neural network trained to detect people. It separates an individual in the foreground from whatever is in the background, with greater detail and clarity than with the depth map alone. It achieves this clarity in part because the matte image has higher resolution than the depth map.

For information about capturing the portrait effects matte, see [Configuring camera capture to collect a Portrait Effects matte](/documentation/AVFoundation/configuring-camera-capture-to-collect-a-portrait-effects-matte). To learn how to extract a portrait effects matte from photos previously captured in portrait mode on a device running iOS 12, see [Extracting Portrait Effects matte image data from a photo](/documentation/AVFoundation/extracting-portrait-effects-matte-image-data-from-a-photo).

## Topics

### Creating a Portrait Effects matte

[Configuring camera capture to collect a Portrait Effects matte](/documentation/AVFoundation/configuring-camera-capture-to-collect-a-portrait-effects-matte)

Prepare your app to capture a portrait effects matte when taking photos.

[`init(fromDictionaryRepresentation:)`](/documentation/AVFoundation/AVPortraitEffectsMatte/init(fromDictionaryRepresentation:))

Initializes a portrait effects matte instance from auxiliary image information in an image file.

[`applyingExifOrientation(_:)`](/documentation/AVFoundation/AVPortraitEffectsMatte/applyingExifOrientation(_:))

Returns a derivative portrait effects matte after applying the specified EXIF orientation.

[`replacingPortraitEffectsMatte(with:)`](/documentation/AVFoundation/AVPortraitEffectsMatte/replacingPortraitEffectsMatte(with:))

Returns a portrait effects matte by wrapping the replacement pixel buffer.

### Examining a Portrait Effects matte

[Extracting Portrait Effects matte image data from a photo](/documentation/AVFoundation/extracting-portrait-effects-matte-image-data-from-a-photo)

Check for portrait effects matte metadata in existing images.

[`mattingImage`](/documentation/AVFoundation/AVPortraitEffectsMatte/mattingImage)

The portrait effects matte’s internal image, formatted as a pixel buffer.

[`pixelFormatType`](/documentation/AVFoundation/AVPortraitEffectsMatte/pixelFormatType)

The pixel format type of this portrait effects matte’s internal image.

[`dictionaryRepresentation(forAuxiliaryDataType:)`](/documentation/AVFoundation/AVPortraitEffectsMatte/dictionaryRepresentation(forAuxiliaryDataType:))

A dictionary of primitive map information used for writing an image file with a portrait effects matte.



---

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)