<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIImage/imageWithCGImage:",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIImage(cm)imageWithCGImage:"
  },
  "title" : "imageWithCGImage:"
}
-->

# imageWithCGImage:

Creates and returns an image object representing the specified Quartz image.

```
+ (UIImage *) imageWithCGImage:(CGImageRef) cgImage;
```

## Parameters

`cgImage`

The Quartz image object.

## Return Value

A new image object for the specified Quartz image, or `nil` if the method could not initialize the image from the specified image reference.

## Discussion

This method does not cache the image object. You can use the methods of the Core Graphics framework to create a Quartz image reference.

---

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)