<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 14.0.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCapturePhotoFileDataRepresentationCustomizer/replacementSemanticSegmentationMatte(ofType:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(pl)AVCapturePhotoFileDataRepresentationCustomizer(im)replacementSemanticSegmentationMatteOfType:forPhoto:"
  },
  "title" : "replacementSemanticSegmentationMatte(ofType:for:)"
}
-->

# replacementSemanticSegmentationMatte(ofType:for:)

Replaces or removes the semantic segmentation matte of the specified type from the flattened file data representation.

```
optional func replacementSemanticSegmentationMatte(ofType semanticSegmentationMatteType: AVSemanticSegmentationMatte.MatteType, for photo: AVCapturePhoto) -> AVSemanticSegmentationMatte?
```

## Parameters

`semanticSegmentationMatteType`

The type of semantic segmentation matte to be replaced or stripped.

`photo`

The calling instance of [`AVCapturePhoto`](/documentation/AVFoundation/AVCapturePhoto).

## Return Value

An instance of [`AVSemanticSegmentationMatte`](/documentation/AVFoundation/AVSemanticSegmentationMatte). To preserve the existing matte, return `photo.```AVCapturePhoto/semanticSegmentationMatte(for:)``. To strip the existing one, return `nil`. To replace, provide a replacement [`AVSemanticSegmentationMatte`](/documentation/AVFoundation/AVSemanticSegmentationMatte) instance.

## Discussion

This callback is optional. If your delegate doesn’t implement this callback, the existing semantic segmentation matte of the specified type in the in-memory [`AVCapturePhoto`](/documentation/AVFoundation/AVCapturePhoto) container is written to the file data representation.

---

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)