What's the best approach to showing layer thumbnails in a UXP plugin ui?

I’m building a UXP plugin and want to show thumbnails in the UI, for layers, masks and channels.

So far, I can’t find a direct way to access layer/channel/mask thumbnails (layer previews). I kind of assumed they wouldn’t be accessible, but I’m holding out hope that I’m wrong about that.

My other solution is exporting small thumbnails periodically or on some trigger and rendering them in the UI.

Wondering if anyone else has considered this or has approached something similar and can share any info. Some way of getting some usable data from temp or any other tricks?

Update: Got a version working using the imaging api. Haven’t pushed it but it seems to do what I need without any performance issues so far.

2 Likes

Can you please post a bit of code to share? I’m interested in using that for an internal plugin at work…

Maybe do this:
Download the imaging-test plugin from the bottom of:
https://developer.adobe.com/photoshop/uxp/2022/ps_reference/media/imaging/

Then open main.js and look for “function getImageThumbnail()”.
That method will get a layer thumbnail if you provide a layerID

3 Likes