Images
Declare images to load a public HTTPS PNG through the host. Add styling when applying that image to a Fluxer element.
Load a resource for your sandbox
Section titled “Load a resource for your sandbox”Replace the URL with a real public PNG you control. This example handles failure and releases the owned image during cleanup.
try { const resource = await api.images.load("https://example.org/sprite.png"); cleanup.push(() => { void api.images.release(resource.handle).catch(() => {}); }); const image = document.createElement("img"); image.alt = "Plugin sprite preview"; image.src = await api.images.url(resource.handle); document.body.append(image); cleanup.push(() => image.remove());} catch { api.logger.warn("Image unavailable; check the public HTTPS PNG URL.");}Display the sandbox with openView, which also requires ui. Loading an image alone does not open a view.
For a host element, pass the owned image handle as imageHandle in a styling rule and dispose the rule before releasing the image.
Resource policy
Section titled “Resource policy”Only public HTTPS PNGs are supported: eight-second deadline, 1 MiB response ceiling, maximum 2048 pixels per dimension, 1,048,576 total pixels, and three redirects. There are at most eight simultaneous/retained image resources per instance.
Private or mixed DNS results, literal IPs, embedded credentials, and nonstandard ports are rejected. Addresses are pinned through connection establishment; Electron decodes and re-encodes the content.
The API returns dimensions and an owned handle, not a general HTTP response. Handles belong to the instance and cannot be transferred between plugins. The host releases remaining resources on shutdown; plugins should still release resources they no longer need.
