Hi @prof !
I think this is only just now supported in Beta. Check out this documentation: https://developer.adobe.com/photoshop/uxp/2022/ps_reference/media/imaging/ as well as this forum thread: 🎉 Imaging API Documentation update, plus expanded TextItem capabilities
As far as I can tell from the very bottom of the document:
With the current version of UXP you must use jpeg/base64 encoding when assigning to an image element.
Maybe I’m not reading it right, but perhaps png
isn’t supported yet?