<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.11.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MetalKit",
  "identifier" : "/documentation/MetalKit/MTKTextureLoader/newTexture(cgImage:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "MetalKit"
    ],
    "preciseIdentifier" : "c:objc(cs)MTKTextureLoader(im)newTextureWithCGImage:options:error:"
  },
  "title" : "newTexture(cgImage:options:)"
}
-->

# newTexture(cgImage:options:)

Synchronously loads image data and creates a new Metal texture from a given bitmap image.

```
func newTexture(cgImage: CGImage, options: [MTKTextureLoader.Option : Any]? = nil) throws -> any MTLTexture
```

## Parameters

`cgImage`

The <doc://com.apple.documentation/documentation/CoreGraphics/CGImage> from which to load image data.

`options`

A dictionary describing any additional texture loading steps. See `Texture Loading Options`.

## Return Value

A fully loaded and initialized Metal texture, or `nil` if an error occurred.

## Discussion

---

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)