<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/vImage_Buffer/init(cgImage:flags:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:So13vImage_BufferV10AccelerateE02cgA05flagsABSo10CGImageRefa_AC01vA0O7OptionsVtKcfc"
  },
  "title" : "init(cgImage:flags:)"
}
-->

# init(cgImage:flags:)

Creates a new buffer with the contents of a Core Graphics image.

```
init(cgImage: CGImage, flags options: vImage.Options = .noFlags) throws
```

## Parameters

`cgImage`

The source image.

`options`

The options to use when performing the operation.

## Discussion

This function initializes a vImage buffer using the format of the Core Graphics image.

---

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)