Skip to main content

LensStudio:AssetUtils.js.importImageAsTexture

Function

Imports an image as a texture and sets up its wrap mode.

importImageAsTexture(assetManager, imageFileAbsolutePath, wrapMode?, imageImportDestinationDir?): Promise<{ imageAsset: Asset; textureParam: TextureParameter; }>

Imports an image as a texture and sets up its wrap mode.

Parameters

ParameterTypeDescription
assetManagerAssetManager-
imageFileAbsolutePathstringThe absolute path to the image file.
wrapMode?WrapModeThe wrap mode for the texture. Defaults to Editor.Assets.WrapMode.ClampToEdge.
imageImportDestinationDir?stringThe directory where the image will be imported. Defaults to "Images".

Returns

Promise<{ imageAsset: Asset; textureParam: TextureParameter; }>

An object containing the image asset and texture parameter.

Throws

Will log an error if the image asset fails to load.