---
title: "newTexture(cgImage:options:)"
framework: metalkit
role: symbol
role_heading: Instance Method
path: "metalkit/mtktextureloader/newtexture(cgimage:options:)"
---

# newTexture(cgImage:options:)

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

## Declaration

```swift
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

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

## See Also

### Loading Textures from Core Graphics Images

- [newTexture(cgImage:options:completionHandler:)](metalkit/mtktextureloader/newtexture(cgimage:options:completionhandler:).md)
