How to load an ImageFill from the plug-in package?

How do you load a PNG image resource from the plug-in package for use in an ImageFill if it is in Images/logo.png?

Do you want to insert that image in an artboard or in the plugin UI?

insert the image on the artboard.

It is not possible to specify an absolute file path (except for special folders like a plugin data folder – cf. Is this correct to use image fill) in plugins for XD. However, you can prompt the user to select a file and then use it as fill for an object as described in https://adobexdplatform.com/plugin-docs/reference/ImageFill.html.

From how I understand your use-case, you want to use an image distributed in the plugin folder, correct? If so, you can first use FileSystemProvider::getPluginFolder() (cf. https://adobexdplatform.com/plugin-docs/reference/uxp/module/storage.html#filesystemprovidergetpluginfolder-⇒-promisefolder) to get a reference to the plugin folder, then use folder.getEntry('Images/logo.png') on that folder reference to get a reference to your image and then use that reference like the imageFile in the ImageFill docs.

I hope this helps, if you need any further help, please feel free to say so :wink:
Happy Coding,
Pablo