<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVSemanticSegmentationMatte/replacingSemanticSegmentationMatte(with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVSemanticSegmentationMatte(im)semanticSegmentationMatteByReplacingSemanticSegmentationMatteWithPixelBuffer:error:"
  },
  "title" : "replacingSemanticSegmentationMatte(with:)"
}
-->

# replacingSemanticSegmentationMatte(with:)

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

```
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

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

## 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.

---

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)