---
title: "replacingSemanticSegmentationMatte(with:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avsemanticsegmentationmatte/replacingsemanticsegmentationmatte(with:)"
---

# replacingSemanticSegmentationMatte(with:)

Returns a semantic segmentation matte instance that wraps the replacement pixel buffer.

## Declaration

```swift
func replacingSemanticSegmentationMatte(with pixelBuffer: CVPixelBuffer) throws -> Self
```

## Parameters

- `pixelBuffer`: A pixel buffer containing a semantic segmentation matting image, represented as doc://com.apple.documentation/documentation/CoreVideo/kCVPixelFormatType_OneComponent8 with a doc://com.apple.documentation/documentation/CoreVideo/kCVImageBufferTransferFunction_Linear transfer function.

## Return Value

Return Value A new semantic segmentation matte instance, or nil if the pixel buffer is malformed.

## Discussion

Discussion When applying complex edits to media containing a semantic segmentation matte, you may create a derivative matte with arbitrary transforms applied to it. You can then use this method to create a new semantic segmentation matte instance.

## See Also

### Creating a segmentation matte

- [init(fromImageSourceAuxiliaryDataType:dictionaryRepresentation:)](avfoundation/avsemanticsegmentationmatte/init(fromimagesourceauxiliarydatatype:dictionaryrepresentation:).md)
- [applyingExifOrientation(_:)](avfoundation/avsemanticsegmentationmatte/applyingexiforientation(_:).md)
- [dictionaryRepresentation(forAuxiliaryDataType:)](avfoundation/avsemanticsegmentationmatte/dictionaryrepresentation(forauxiliarydatatype:).md)
