---
title: previewCGImageRepresentation()
framework: avfoundation
role: symbol
role_heading: Instance Method
path: avfoundation/avcapturephoto/previewcgimagerepresentation()
---

# previewCGImageRepresentation()

Extracts and returns the captured photo’s preview image as a Core Graphics image object.

## Declaration

```swift
func previewCGImageRepresentation() -> CGImage?
```

## Return Value

Return Value A Core Graphics image representation of the captured photo, or nil if either the image cannot be converted or a preview image was not requested as part of the photo capture.

## See Also

### Packaging data for file output

- [fileDataRepresentation(with:)](avfoundation/avcapturephoto/filedatarepresentation(with:).md)
- [AVCapturePhotoFileDataRepresentationCustomizer](avfoundation/avcapturephotofiledatarepresentationcustomizer.md)
- [fileDataRepresentation()](avfoundation/avcapturephoto/filedatarepresentation().md)
- [cgImageRepresentation()](avfoundation/avcapturephoto/cgimagerepresentation().md)
- [fileDataRepresentation(withReplacementMetadata:replacementEmbeddedThumbnailPhotoFormat:replacementEmbeddedThumbnailPixelBuffer:replacementDepthData:)](avfoundation/avcapturephoto/filedatarepresentation(withreplacementmetadata:replacementembeddedthumbnailphotoformat:replacementembeddedthumbnailpixelbuffer:replacementdepthdata:).md)
