PDA

View Full Version : Photoshop from command line?


Phil Steinmeyer
10-23-2006, 10:25 PM
My art pipeline is set up so that all conversions from 'base' types (usually 32 bit PNG) to 'compiled types' (usually jpeg plus 8 bit PNG for alpha channel) is done in batch files (i.e. command line).

I use ImageMagick's tools for most of my batch processing and conversions (specifically, the 'convert' tool).

I've just been tinkering and noticed that Photoshop's ImageReady tool seems to do a little better job on these conversions - slightly smaller file sizes.

But I don't want to have to manually do a 'save as' for each of my files - I have several hundred, and I like to be able to do a full rebuild easily from the command line.

Is there any way to access Photoshop/ImageReady from the command line for this kind of stuff?

If not, is there an easy way to use PS/IR's IDE to batch convert hundreds of PNGs easily?

Or, is there another command-line tool out there besides ImageMagick and PS/IR that I should be looking at?

soniCron
10-23-2006, 10:29 PM
You should be able to create an action for "Save For Web..." to automate the process. (Make sure you accept the default/given filename when recording - it'll give each file a unique name when you play back.) Then just run it through the batch processor for the whole directory.

Specific Instructions
In Photoshop, open any image.
Select the foreground color for whatever opaque color you're using.
Select the background color for whatever transparent color you're using.
Begin recording a new action.
Click "File> Save for Web..."
Select your JPG compression settings.
Click "Save" and "Save" again, preserving the filename it gives you. (I believe you can select the directory you'd like to save in without messing up the script - experiment with this.)
Lock the alpha channel on the layers palette.
Click "Edit> Fill..." and fill with the foreground color.
Create a new layer and drag it below the original.
Click "Edit> Fill..." and fill the new layer with your background color.
Click "File> Save for Web..."
Select your PNG compression settings.
Click "Save" and "Save" again, preserving the filename it gives you. (Again, I believe you can select the directory you'd like to save in without messing up the script - experiment with this.)
Close the window, discarding changes.
Stop recording.
Click "File> Automate> Batch..."
Under "Set," select the set where you saved your action.
Select the appropriate action under, "Action."
Make sure "Source" is set to "Folder"
Click "Choose..." and select the appropriate source folder.
Optionally check both "Suppress..." options.
Click "OK"

Sillysoft
10-24-2006, 03:41 AM
For dealing with PNGs, check out the pngcrush and/or pngout applications. They will do some magic with the PNG that reduces filesize without changing the image at all. They have command line interfaces.