---
title: "imageWithCGImage:"
framework: uikit
role: symbol
role_heading: Type Method
path: "uikit/uiimage/imagewithcgimage:"
---

# imageWithCGImage:

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

## Declaration

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

## Parameters

- `cgImage`: The Quartz image object.

## Return Value

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

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.

## See Also

### Creating and initializing image objects

- [imageWithContentsOfFile:](uikit/uiimage/imagewithcontentsoffile:.md)
- [imageWithData:](uikit/uiimage/imagewithdata:.md)
- [imageWithData:scale:](uikit/uiimage/imagewithdata:scale:.md)
- [imageWithCGImage:scale:orientation:](uikit/uiimage/imagewithcgimage:scale:orientation:.md)
- [imageWithCIImage:](uikit/uiimage/imagewithciimage:.md)
- [imageWithCIImage:scale:orientation:](uikit/uiimage/imagewithciimage:scale:orientation:.md)
- [init(contentsOfFile:)](uikit/uiimage/init(contentsoffile:).md)
- [init(data:)](uikit/uiimage/init(data:).md)
- [init(data:scale:)](uikit/uiimage/init(data:scale:).md)
- [init(cgImage:)](uikit/uiimage/init(cgimage:)-14qlb.md)
- [init(cgImage:scale:orientation:)](uikit/uiimage/init(cgimage:scale:orientation:)-2ouhh.md)
- [init(ciImage:)](uikit/uiimage/init(ciimage:)-93vu1.md)
- [init(ciImage:scale:orientation:)](uikit/uiimage/init(ciimage:scale:orientation:)-9gpyn.md)
- [UIImageReader](uikit/uiimagereader-c.class.md)
- [UIImageReaderConfiguration](uikit/uiimagereaderconfiguration.md)
