---
title: "newTexture(name:scaleFactor:displayGamut:bundle:options:)"
framework: metalkit
role: symbol
role_heading: Instance Method
path: "metalkit/mtktextureloader/newtexture(name:scalefactor:displaygamut:bundle:options:)"
---

# newTexture(name:scaleFactor:displayGamut:bundle:options:)

Synchronously loads image data and creates a Metal texture from the named texture asset in an asset catalog, using a specified display gamut.

## Declaration

```swift
func newTexture(name: String, scaleFactor: CGFloat, displayGamut: NSDisplayGamut, bundle: Bundle?, options: [MTKTextureLoader.Option : Any]? = nil) throws -> any MTLTexture
```

## Parameters

- `name`: The name of a texture in an asset catalog.
- `scaleFactor`: The scale factor of texture to request. In iOS and tvOS, pass the doc://com.apple.documentation/documentation/QuartzCore/CALayer/contentsScale value of the view where you plan to display texture content. In macOS, pass the doc://com.apple.documentation/documentation/AppKit/NSWindow/backingScaleFactor value of the window where you plan to display texture content.
- `displayGamut`: The version of the texture based on the Gamut trait in Xcode. To determine the appropriate parameter value, pass the widest NSDisplayGamut value that returns doc://com.apple.documentation/documentation/Swift/true when queried against the canRepresentDisplayGamut: method of NSWindow.
- `bundle`: The resource bundle containing the asset catalog to load textures from.
- `options`: A dictionary describing any additional texture loading steps. See Texture Loading Options. When using this method, the texture loader ignores the doc://com.apple.metalkit/documentation/MetalKit/MTKTextureLoader/Option/generateMipmaps, doc://com.apple.metalkit/documentation/MetalKit/MTKTextureLoader/Option/SRGB, doc://com.apple.metalkit/documentation/MetalKit/MTKTextureLoader/Option/cubeLayout, and doc://com.apple.metalkit/documentation/MetalKit/MTKTextureLoader/Option/origin options.

## Return Value

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

## See Also

### Loading Textures from Asset Catalogs

- [newTexture(name:scaleFactor:bundle:options:)](metalkit/mtktextureloader/newtexture(name:scalefactor:bundle:options:).md)
- [newTexture(name:scaleFactor:bundle:options:completionHandler:)](metalkit/mtktextureloader/newtexture(name:scalefactor:bundle:options:completionhandler:).md)
- [newTextures(names:scaleFactor:bundle:options:completionHandler:)](metalkit/mtktextureloader/newtextures(names:scalefactor:bundle:options:completionhandler:).md)
- [newTexture(name:scaleFactor:displayGamut:bundle:options:completionHandler:)](metalkit/mtktextureloader/newtexture(name:scalefactor:displaygamut:bundle:options:completionhandler:).md)
- [newTextures(names:scaleFactor:displayGamut:bundle:options:completionHandler:)](metalkit/mtktextureloader/newtextures(names:scalefactor:displaygamut:bundle:options:completionhandler:).md)
