Python Photoshop Automation without win32com.

Clunky but kinda fun, its possible to automate Photoshop using Javascript files passed as arguments to the subprocess. 

Although this essentially means you have to write your script in two languages (PS's native JS and Python for pipeline) the practical aspect of this is that it allows scripts to be written that do not require people to have the win32com/comtypes modules installed, and paves the way for cross platform scripts that aren't tied to windows only modules. 

I've had some success with creating a dynamic JavaScript builder that wraps Python functions around Photoshop's native Javascript commands. When the list of commands is executed it is compiled into a jsx file and then passed on to the Photoshop subprocess as an argument.

The only short coming right now is obtaining the output from Photoshop and making it into a two-way street. I have some ideas on how to do this, and will update with the solution I end up using. 


2 comments:

  1. Hi, I'm experimenting with this idea as well, do you have any code to show, or is this just a notion at this point?

    ReplyDelete
    Replies
    1. Hey Nathan, glad to know other people are tinkering with the same thing!

      I've put up a simple working example in another blog post here:
      http://peterhanshawart.blogspot.com/2013/10/python-photoshop-automation-without_29.html

      Delete

Comments?