<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKTexture/cgImage()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKTexture(im)CGImage"
  },
  "title" : "cgImage()"
}
-->

# cgImage()

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

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

## Discussion

The [`cgImage()`](/documentation/SpriteKit/SKTexture/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:

1. Use the [`texture(from:)`](/documentation/SpriteKit/SKView/texture(from:)) method to render the scene’s contents to a texture.
2. Call [`cgImage()`](/documentation/SpriteKit/SKTexture/cgImage()) on the result.
3. Use <doc://com.apple.documentation/documentation/ImageIO/CGImageDestination> to write the `CGImage` out to disk.

---

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)