---
title: cgImage()
framework: spritekit
role: symbol
role_heading: Instance Method
path: spritekit/sktexture/cgimage()
---

# cgImage()

Returns the texture’s image data as a Quartz 2D image.

## Declaration

```swift
func cgImage() -> CGImage
```

## Discussion

Discussion The cgImage() property returns the contents of a texture as a Quartz Image. As an example use, you can create an image from a portion of your scene and save it to disk by doing the following: Use the texture(from:) method to render the scene’s contents to a texture. Call cgImage() on the result. Use CGImageDestination to write the CGImage out to disk.
