---
title: "replacementEmbeddedThumbnailPixelBuffer(withPhotoFormat:for:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avcapturephotofiledatarepresentationcustomizer/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.

## Declaration

```swift
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, doc://com.apple.avfoundation/documentation/AVFoundation/AVVideoCodecKey is required, with width and height keys optional.
- `photo`: The calling instance of doc://com.apple.avfoundation/documentation/AVFoundation/AVCapturePhoto whose file metadata you’re modifying.

## Return Value

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

Discussion This callback is optional. If your delegate doesn’t implement this callback, the existing metadata in the in-memory AVCapturePhoto container is written directly to the file data representation.

## See Also

### Replacing or removing metadata

- [replacementMetadata(for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementmetadata(for:).md)
- [replacementDepthData(for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementdepthdata(for:).md)
- [replacementPortraitEffectsMatte(for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementportraiteffectsmatte(for:).md)
- [replacementSemanticSegmentationMatte(ofType:for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementsemanticsegmentationmatte(oftype:for:).md)
- [replacementAppleProRAWCompressionSettings(for:defaultSettings:maximumBitDepth:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementappleprorawcompressionsettings(for:defaultsettings:maximumbitdepth:).md)
