Import a file from the plugin folder to photoshop

My code:

const fs =;
        const pluginFolder = await fs.getPluginFolder();
        const theTemplate = await pluginFolder.getEntry("1.jpg");
        let arr = await{format: formats.binary});
        const imageData = await imaging.createImageDataFromBuffer(
            new Uint8Array(arr),
                width: 501,
                height: 350,
                components: 3,
                colorSpace: "RGB",
                chunky: false
                colorProfile: "Adobe RGB (1998)"
        let layerInfo = await photoshop.core.executeAsModal(() => app.activeDocument.createLayer({name: 'newLayer'}))
        let putPixelsOptions = {layerID:, imageData: imageData}
        await photoshop.core.executeAsModal(() => imaging.putPixels(putPixelsOptions))


This happens with any image (OC Windows 10)

  • I do not know what I am doing wrong. And once I did about the same code and everything worked. The width and height correspond to my image. I also don’t understand why all the parameters are required. Why uxp won’t immediately take the width and height of my image. And why can’t he determine the number of components per pixel?

I can not help you fix your specific problem, as I do not know enough.
I have just solved the same problem in a different way. If you do not explicitly need to import the image as binary, maybe this could help?