How do i fill the selection with a image which is in the plugin folder

How do i fill the artboard with a image which is in the plugin folder

const pluginFolders = await fs.getPluginFolder();
const entries = await pluginFolders.getEntries();
const compressedImage = await pluginFolder.getEntry('rendition.jpg');
let fill = new ImageFill(compressedImage);

selection.items[0].fill = fill(fill);

When I run the console says:
Plugin Error: Cannot load ImageFill from path: “my image file path”
at new ImageFill (plugins/BitmapFillWrapper.js:1:514)

1 Like

Is rendition.jpg in the top level of your plugin folder? And is the case identical?

If you’re using getEntry, you shouldn’t also need to use getEntries. But since you have that, can you console.log(entries) and see what’s in the directory?

In the console it shows this:

[ {}, {}, {}, {}, {}, {} ]

when console.log(entries);

There is a typo in the code:
line 1: ‘pluginFolders’
line 3: ‘pluginFolder’

HIH

Thanks Alot
That helped!

1 Like