<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 14.0.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCapturePhotoFileDataRepresentationCustomizer",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(pl)AVCapturePhotoFileDataRepresentationCustomizer"
  },
  "title" : "AVCapturePhotoFileDataRepresentationCustomizer"
}
-->

# AVCapturePhotoFileDataRepresentationCustomizer

A protocol that defines the methods to implement to customize the packaging of photo data.

```
protocol AVCapturePhotoFileDataRepresentationCustomizer : NSObjectProtocol
```

## Overview

AVCapturePhoto is a wrapper representing a photo in a file container. To flatten the photo to an <doc://com.apple.documentation/documentation/Foundation/NSData> object to write to file, call [`fileDataRepresentation()`](/documentation/AVFoundation/AVCapturePhoto/fileDataRepresentation()). For more complex flattening operations such as replacing or stripping metadata, call [`fileDataRepresentation(with:)`](/documentation/AVFoundation/AVCapturePhoto/fileDataRepresentation(with:)) and provide a delegate for customized replacement or stripping behavior. This delegate’s methods are called synchronously before the flattening process begins.

## Topics

### Replacing or removing metadata

[`func replacementMetadata(for: AVCapturePhoto) -> [String : Any]?`](/documentation/AVFoundation/AVCapturePhotoFileDataRepresentationCustomizer/replacementMetadata(for:))

A callback in which you can provide replacement metadata or direct [`AVCapturePhoto`](/documentation/AVFoundation/AVCapturePhoto) to strip existing metadata from the flattened file.

[`func replacementEmbeddedThumbnailPixelBuffer(withPhotoFormat: AutoreleasingUnsafeMutablePointer<NSDictionary?>, for: AVCapturePhoto) -> Unmanaged<CVPixelBuffer>?`](/documentation/AVFoundation/AVCapturePhotoFileDataRepresentationCustomizer/replacementEmbeddedThumbnailPixelBuffer(withPhotoFormat:for:))

A callback in which you can provide a replacement embedded thumbnail image with compression settings, or strip the existing embedded thumbnail image from the flattened file.

[`func replacementDepthData(for: AVCapturePhoto) -> AVDepthData?`](/documentation/AVFoundation/AVCapturePhotoFileDataRepresentationCustomizer/replacementDepthData(for:))

A callback in which you can provide replacement depth data or strip existing depth data from the file.

[`func replacementPortraitEffectsMatte(for: AVCapturePhoto) -> AVPortraitEffectsMatte?`](/documentation/AVFoundation/AVCapturePhotoFileDataRepresentationCustomizer/replacementPortraitEffectsMatte(for:))

A callback in which you can provide a replacement portrait effects matte, or strip the existing portrait effects matte from the file.

[`func replacementSemanticSegmentationMatte(ofType: AVSemanticSegmentationMatte.MatteType, for: AVCapturePhoto) -> AVSemanticSegmentationMatte?`](/documentation/AVFoundation/AVCapturePhotoFileDataRepresentationCustomizer/replacementSemanticSegmentationMatte(ofType:for:))

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

[`func replacementAppleProRAWCompressionSettings(for: AVCapturePhoto, defaultSettings: [String : Any], maximumBitDepth: Int) -> [String : Any]`](/documentation/AVFoundation/AVCapturePhotoFileDataRepresentationCustomizer/replacementAppleProRAWCompressionSettings(for:defaultSettings:maximumBitDepth:))

Replaces the compression settings the system uses when writing Apple ProRAW data to a Linear DNG file.

## Relationships

### Inherits From

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

---

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)