Photoshop Embedded Python Pipeline


[QUOTE=CBen;13498]Hi there. I helped on the project. If you built it straight from what was downloaded, then the pyInterpreter is importing an in house python module and calling functions from that module. That is why nothing is showing up.

Gotta edit the Listener.cpp file to make the interpreter do what you want.
Note-It is also currently hooked into Save/Open operations, but that can be edited.


This ^^^

The current plugin allows a python interpreter to run inside of PS accessible from the API (or technically anything that can talk within PS).

if you take a look at the listener.cpp file, specifically:

PyRun_SimpleString("import nas.photoshop.init as ps


Our code is setup to launch a python script ( I will attach the script as an example of “what” we are doing with it).

The point of that is, once you have an interpreter, you can marshall from PS <–> python directly instead of having to use the “com”. You can technically hook any of the PS API events/commands to spit out things to the interpreter.

We currently leverage this to capture some photoshop “events” like saving files, opening, etc… that are captured by a python script, which in turn logs those events into our database.

I have commented out some of the specific implementation we use, and this requires win32 (for windows). Of course that can all be replaced/removed, etc… depending on need of course.

If you are wanting to put a full blown QT window in PS and have it interact with PS, absolutely possible, just need to start adding to the plugin to allow that communication level.

You can see some of the cursory hook for that in the source.

We “currently” have no need to have a full blown QT app up though we are definitely moving our design team more into the fold of our CG side, and since we are all DB driven on this side already, we have started designing with the intention to hook our QT toolset(s) into PS directly.

Just not this year =p


Awesome, i’m gonna try to get this to fly next week :slight_smile:

On a side note, i wrote an alternative to the whole COM nonsense using CS5.1’s socket server. There were good examples in Java and objectiveC so i ported those to python and wrapped them nicely. Now i need to get the boss to approve open sourcing. I wrote it outside, so hopefully it won’t be a big deal.

You can send any JS to PS, request a thumbnail of the current doc, and subscribe to various events from PS. From my tests it’s pretty quick.

I do like Amorano or rmwatsons approach as it gives custom menus and QT. The socket connection is a good alternative if you don’t want/cant build the plugs.



I have the plugin compiled in VS2008 for CS 5.1 fine. Thanks so much for sharing the source Amorano!

I was wondering if anyone knows where the hooks to edit the PS menus are in the SDK. I would love to be able to add a “Company Save” into the File menu. I noticed that was one of the features that sparked this thread. Even if the python bindings weren’t available, it would be great to try and figure out how to add in extra menu items.

Any shortcuts would be great. Otherwise I’ll keep looking around to try and find where that code is.

Thanks again for sharing this!



It seems that this tool is stalled. What are people using nowdays? And where someone can find this tool? I am writing here my own Photoshop Python API so feel free to interact :slight_smile:

#45 Sharing this here as well as not many people know it is available.