style

style.setNodeImage

setNodeImage(nodeId: string, url: string): Promise<void>

Assign or clear a texture image URL for a single node.

Pass null to remove the image. Recorded in history as "SetNodeImage". Does not emit "style:changed".

nodeIdstringId of the node to modify.
urlstringAbsolute or relative URL of the image texture, or null to clear.

Returns: Promise<void>

Example

await api.style.setNodeImage("s1", "https://example.com/avatar.png");
await api.style.setNodeImage("s1", null); // remove image