<!--
{
  "availability" : [
    "macOS: 10.4.0 - 10.11.0"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIContext/createCGLayer(with:info:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIContext(im)createCGLayerWithSize:info:"
  },
  "title" : "createCGLayer(with:info:)"
}
-->

# createCGLayer(with:info:)

Creates a CGLayer object from the provided parameters.

```
func createCGLayer(with size: CGSize, info: CFDictionary?) -> CGLayer?
```

## Parameters

`size`

The size, in default user space units, of the layer relative to the graphics context.

`info`

A dictionary, which is passed to `CGLayerCreateWithContext` as the `auxiliaryInfo` parameter. Pass `NULL` because this parameter is reserved for future use.

## Return Value

A CGLayer object.

## Discussion

After calling this method, Core Image draws content into the CGLayer object. Core Image creates a CGLayer object by calling the Quartz 2D function <doc://com.apple.documentation/documentation/CoreGraphics/CGLayer/init(_:size:auxiliaryInfo:)>, whose prototype is:

```objc
CGLayerRef CGLayerCreateWithContext (
   CGContextRef context,
   CGSize size,
   CFDictionaryRef auxiliaryInfo
);
```

Core Image passes the [`CIContext`](/documentation/CoreImage/CIContext) object as the `context` parameter, the size as the `size` parameter, and the dictionary as the `auxiliaryInfo` parameter. For more information on CGLayer objects, see [Quartz 2D Programming Guide](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/Introduction/Introduction.html#//apple_ref/doc/uid/TP30001066) and <doc://com.apple.documentation/documentation/CoreGraphics/CGLayer>.

## See Also

[`+  imageWithCGLayer:`](/documentation/CoreImage/CIImage/imageWithCGLayer:)

Creates and returns an image object from the contents supplied by a `CGLayer` object.

[`+  imageWithCGLayer:options:`](/documentation/CoreImage/CIImage/imageWithCGLayer:options:)

Creates and returns an image object  from the contents supplied by a `CGLayer` object, using the  specified options.



---

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)