How do I export layers in a document as PNG programmatically using UXP?

I am trying to export layers as png to a user-defined file location using a for loop. There is no clear documentation or examples on how to do this, and previous questions on this topic have vague answers. Does anyone have a code sample on how to do this?

I also tried the artboard export example here (https://github.com/AdobeDocs/uxp-photoshop-plugin-samples/blob/main/jszip-sample/src/index.js) but the await function never returns and it’s hard to debug the callback function.

1 Like