Channel Ports from a hybrid .uxpaddon: any way to get a live document port?

I do processing natively in a .uxpaddon and I would live to be able to read and write the document’s pixels from there.

PSDLLMain fires in the addon and I can acquire kPSChannelPortsSuite fine. What I can’t find is any way to get a handle on the actual document’s ports from that context. The descriptor argument comes in null. Every read call takes a port you already hold, and the only two port-producing methods are New(), which gives a blank scratch port, and NewCopyOnWrite(), which needs a base port you already have. As far as I can tell, live ports only ever arrive through a plug-in’s documentInfo, which an addon never gets.

Is there a way to source a live document port from inside an addon, or is that not possible by design?

Hi @Kayrock,

According to my internal sources:

There is no supported way for a third-party .uxpaddon to source the active document’s live Channel Port from PSDLLMain. The null descriptor is expected in that context, and kPSChannelPortsSuite does not provide a current-document lookup. Use Photoshop’s UXP imaging API to obtain an Image/pixel buffer by document and layer ID, process that data in the native addon, and write it back through the imaging API. If direct access to Photoshop-native Channel Ports is essential, that requires a separate traditional Photoshop C++ plugin entry point rather than the UXP addon alone.

And then citing the documentation:

Thanks for your quick reply! Yes, the JS imagingAPI is great, but still missing a few key features. The issue with using a separate traditional Photoshop C++ plugin entry point is that PS refuses access while a modal dialog is showing so it can’t be used for live preview.