Fetching image from layer or document to uxp

Is it possible to get the image / mask from a layer, or the composed image from the document through the uxp api, either directly or using batchplay? Either as an javascript Image or an array.

If you’re talking about the pixel data, there’s a feature planned on the roadmap:

I think currently your best/only option is to export the document and read the file data.