---
title: "init(cgContext:options:)"
framework: coreimage
role: symbol
role_heading: Initializer
path: "coreimage/cicontext/init(cgcontext:options:)-6p78w"
---

# init(cgContext:options:)

Creates a Core Image context from a Quartz context, using the specified options.

## Declaration

```swift
init(cgContext cgctx: CGContext, options: [CIContextOption : Any]? = nil)
```

## Parameters

- `cgctx`: A Quartz graphics context.
- `options`: A dictionary that contains color space information. You can pass any of the keys defined in doc://com.apple.coreimage/documentation/CoreImage/CIContextOption along with the appropriate value.

## Discussion

Discussion After calling this method, Core Image draws content to the specified Quartz graphics context. When you create a CIContext object using a Quartz graphics context, any transformations that are already set on the Quartz graphics context affect drawing to that context. note: To obtain a Core Image context for the current AppKit drawing context in macOS, use the NSGraphicsContext ciContext property.
