Cannot create an image layer with uxp

Hi! everyone. Recently I tested a stable diffusion model, which can create greate images using given prompts. The model is running on a server, and I can request the url and get a based64 encoded image. Now I can display the generated image in a tag. Is there any way to put this image into photoshop as an editable layer? Could anybody give some sample code? Thanks a lot!

Have you look at those code samples here?
https://github.com/AdobeDocs/uxp-photoshop-plugin-samples

Would be nice if you pointed to the specific sample. Most of them have nothing to do with raster layers

yeah, I had but found nothing. I think I can save the image locally and use batchplay to load it into photoshop. But in this way, I have to confirm the saving path every time I want to use the generated image. I wondar if there is any way I can use a JS Blob object or something else instead of saving it to my local disk.

You don’t if you use plugin data folder. This doesn’t require a file picker

I’d really appreaciate it if you could provide some sample code!

only sample code that I could find is this one using the fetch API to save and open image: Building an Image Search Plugin for Photoshop | by Ashikka Gupta | Adobe Tech Blog

1 Like

This looks helpful. I’ll try it out. Thanks a lot!

I found another way. I can copy the image into clipboard to aviod saving it locally. But I run into another problem that I cannot use the api navigator.clipboard. Looking for solutions right now.