<!--
{
  "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/UIGraphicsBeginImageContext(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:@F@UIGraphicsBeginImageContext"
  },
  "title" : "UIGraphicsBeginImageContext(_:)"
}
-->

# UIGraphicsBeginImageContext(_:)

Creates a bitmap-based graphics context and makes it the current context.

```
func UIGraphicsBeginImageContext(_ size: CGSize)
```

## Parameters

`size`

The size of the new bitmap context. This represents the size of the image returned by the [`UIGraphicsGetImageFromCurrentImageContext()`](/documentation/UIKit/UIGraphicsGetImageFromCurrentImageContext()) function.

## Discussion

This function is equivalent to calling the [`UIGraphicsBeginImageContextWithOptions(_:_:_:)`](/documentation/UIKit/UIGraphicsBeginImageContextWithOptions(_:_:_:)) function with the opaque parameter set to <doc://com.apple.documentation/documentation/Swift/false> and a scale factor of `1.0`.

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)