1

Is it possible to use Photoshop.exe from command line for various tasks, such as export PSD files?

(I know it's possible with third party tools such as ImageMagick, but here I'm asking specifically about Photoshop.exe)

Example of what I'm looking for:

Phtoshop.exe myfile.psd --export=myfile.png

Phtoshop.exe myfile.psd --export=myfile.jpg

Phtoshop.exe myfile.psd --export=myfile.jpg --resize=600x600,bicubic

What options are available via command line?

Note: I've tested Photoshop.exe -h, Photoshop.exe --help, Photoshop.exe /?, Photoshop.exe /h, but none of them worked.

(Goal: to be able to automate things for hundreds of images, scripting, etc. not from inside Photoshop, but directly from command line.)

4
  • Imagemagick is not in any way related to photoshop.
    – joojaa
    Nov 1, 2019 at 14:41
  • @joojaa Yes that's why I mentioned "third party" tools.
    – Basj
    Nov 1, 2019 at 15:15
  • yes but even photoshop is a third party tool, i mean at least imagemagic comes installed on select operating systems out of the box. Meaning that photoshop is way more third party software than imagemagic is. In conjunction to talking about phostoshop a script or a plug-in would be a third party tool.
    – joojaa
    Nov 1, 2019 at 15:45
  • It seems clear enough that the question is about Photoshop and only Photoshop. Caviling about what does/doesn't constitute a third-party tool isn't relevant to the question. Nov 7, 2019 at 16:15

2 Answers 2

1

If you are willing to write a script wrapper then sure why not. But using the executable for like this makes little sense for the sheer time it takes to start the program to a state that does abdolutely nothing. So you are better of starting photoshop into the bacground and use it as a server (then its speedy enough)

0

It seems not possible via command line with Photoshop.exe.

A possible solution is to use Photoshop via a Python script. As an example, this exports any PSD file into a JPG (resized to a width of 1000 pixels):

from win32com.client import Dispatch

infile = "test.psd"
outfile1 = infile[:-4] + "_export.jpg"

app = Dispatch("Photoshop.Application")
app.Open(infile)
app.Preferences.RulerUnits = 1  # pixels
doc = app.Application.ActiveDocument
options = Dispatch('Photoshop.ExportOptionsSaveForWeb')  
options.Format = 6   # JPG  
options.Quality = 80
doc.ResizeImage(1000)
doc.Export(ExportIn=outfile1, ExportAs=2, Options=options)
doc.Close(Saving=2)  # 2 = psDoNotSaveChanges
app.Quit()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.