<!--
{
  "availability" : [
    "iOS: 2.0.0 - 27.0.0",
    "iPadOS: 2.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "tvOS: -",
    "visionOS: 1.0.0 - 27.0.0",
    "watchOS: 2.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIGraphicsGetImageFromCurrentImageContext()",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:@F@UIGraphicsGetImageFromCurrentImageContext"
  },
  "title" : "UIGraphicsGetImageFromCurrentImageContext()"
}
-->

# UIGraphicsGetImageFromCurrentImageContext()

Returns an image from the contents of the current bitmap-based graphics context.

```
func UIGraphicsGetImageFromCurrentImageContext() -> UIImage?
```

## Return Value

A image object containing the contents of the current bitmap graphics context.

## Discussion

You should call this function only when a bitmap-based graphics context is the current graphics context. If the current context is `nil` or was not created by a call to [`UIGraphicsBeginImageContext(_:)`](/documentation/UIKit/UIGraphicsBeginImageContext(_:)), this function returns `nil`.

This function may be called from any thread of your app.

---

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)