---
title: "replacementSemanticSegmentationMatte(ofType:for:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementsemanticsegmentationmatte(oftype:for:)"
---

# replacementSemanticSegmentationMatte(ofType:for:)

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

## Declaration

```swift
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 doc://com.apple.avfoundation/documentation/AVFoundation/AVCapturePhoto.

## Return Value

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

## Discussion

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 container is written to the file data representation.

## See Also

### Replacing or removing metadata

- [replacementMetadata(for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementmetadata(for:).md)
- [replacementEmbeddedThumbnailPixelBuffer(withPhotoFormat:for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementembeddedthumbnailpixelbuffer(withphotoformat:for:).md)
- [replacementDepthData(for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementdepthdata(for:).md)
- [replacementPortraitEffectsMatte(for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementportraiteffectsmatte(for:).md)
- [replacementAppleProRAWCompressionSettings(for:defaultSettings:maximumBitDepth:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementappleprorawcompressionsettings(for:defaultsettings:maximumbitdepth:).md)
