<!--
{
  "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/replacementEmbeddedThumbnailPixelBuffer(withPhotoFormat:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(pl)AVCapturePhotoFileDataRepresentationCustomizer(im)replacementEmbeddedThumbnailPixelBufferWithPhotoFormat:forPhoto:"
  },
  "title" : "replacementEmbeddedThumbnailPixelBuffer(withPhotoFormat:for:)"
}
-->

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

```
optional func replacementEmbeddedThumbnailPixelBuffer(withPhotoFormat replacementEmbeddedThumbnailPhotoFormatOut: AutoreleasingUnsafeMutablePointer<NSDictionary?>, for photo: AVCapturePhoto) -> Unmanaged<CVPixelBuffer>?
```

## Parameters

`replacementEmbeddedThumbnailPhotoFormatOut`

A pointer to a dictionary of keys and values from `AVFoundation/AVVideoSettings.h`.  If you pass a non-nil dictionary, [`AVVideoCodecKey`](/documentation/AVFoundation/AVVideoCodecKey) is required, with `width` and `height` keys optional.

`photo`

The calling instance of [`AVCapturePhoto`](/documentation/AVFoundation/AVCapturePhoto) whose file metadata you’re modifying.

## Return Value

A pixel buffer containing a source image to be encoded to the file as the replacement thumbnail image. To preserve the existing embedded thumbnail photo to the flattened data, set `replacementEmbeddedThumbnailPhotoFormatOut` to `photo.embeddedThumbnailPhotoFormat` and return `nil`. To replace the existing embedded thumbnail, pass a replacement photo format dictionary and return a non-`nil` replacement pixel buffer.  To remove the existing embedded thumbnail, set `replacementEmbeddedThumbnailPhotoFormatOut` to `nil` and return `nil`.

## Discussion

This callback is optional. If your delegate doesn’t implement this callback, the existing metadata in the in-memory [`AVCapturePhoto`](/documentation/AVFoundation/AVCapturePhoto) container is written directly 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)