Batch Resizing multiple sizes to multiple locations?

Discussion of Automation, Image Workflow and Raw Image Workflow

Moderators: Tom, Kukurykus

fmphoto

Batch Resizing multiple sizes to multiple locations?

Post by fmphoto »

Hello everyone,

I am new here and totally new to Photoshop Scripting.

Now onto my situation.

I currently have a catalog of images sized at 1500x1500, and I need to batch resize them to multiple sizes and ppi.

The output sizes needed are 900x900 (300 ppi), 900 x 900 (72 ppi)825x825 (300 ppi), 500x500 ( 72 ppi), 150 x 150 (72 ppi) and 120 x 120.

What I am envisioning is a script that takes the source TIF image, and then in one process outputs a source image (i.e. Picture-1.TIF or Picture-1.JPG) to each necessary size and saves each new image into its own subfolder (i.e. 900x900) for 900px images.

Is such a process possible with scripting?

All help is greatly appreciated
Patrick

Batch Resizing multiple sizes to multiple locations?

Post by Patrick »

Hello fmphoto, welcome to the forum. I think you will soon fall in love with Photoshop scripting because it works great for tasks like this.

You can start by writing a script that works on 1 image - get it to a point where it resizes it to all the different sizes and different destinations. Once that is working, you can use the batch feature in PS to run that script on a folder of files.

Here is a example script for what you are doing:

Code: Select all// reference the current document open
var doc = app.activeDocument;


// set the options you want to use on export
var options = new ExportOptionsSaveForWeb();
options.quality = 60;   // Start with highest quality (biggest file).
options.format = SaveDocumentType.JPEG;   // Or it'll default to GIF.       
               
// resize
doc.resizeImage(900,900);
// save
doc.exportDocument(new File( "c:\\folder-a\\" + doc.fileName ), ExportType.SAVEFORWEB, options);

// resize
doc.resizeImage(825,825);
// save
doc.exportDocument(new File( "c:\\folder-b\\" + doc.fileName ), ExportType.SAVEFORWEB, options);

You will need to add some other stuff for different dpi's and stuff, but this should get you started. If you need help tweaking that, just post in here and we will help.

Patrick
fmphoto

Batch Resizing multiple sizes to multiple locations?

Post by fmphoto »

This is terrific. I'm doing this for work, so I will try this out Monday when I get it and see what I can do.

Thanks for the assistance, I'm sure this won't be the only question I have.
xbytor

Batch Resizing multiple sizes to multiple locations?

Post by xbytor »

Record an Action that calls Batch for each output fille size, ppi, and naming scheme. Then record a master action that calls each of these batch actions.
Then batch the master action.

This should theoretically work without any scripting required.
fmphoto

Batch Resizing multiple sizes to multiple locations?

Post by fmphoto »

I tried doing something similiar like that with Actions, but I had no luck. I did not do them separate and then combine them into a Master Action though. I will try that. My problems with the actions was that it would only apply the changes to the first image in the folder, but would not touch any of the other image files.

Like I said, I will try this and the scripting on monday and see if I get anywhere.

In actions, if I record myself saving a file to a certain folder with a certain name, won't it just rename all the files the name I entered to save?
xbytor

Batch Resizing multiple sizes to multiple locations?

Post by xbytor »

fmphoto wrote:In actions, if I record myself saving a file to a certain folder with a certain name, won't it just rename all the files the name I entered to save?

The Batch command provides options for specifying the target folder and whatever file-renaming scheme you want. Actions aren't smart enough to do it on their own.
fmphoto

Batch Resizing multiple sizes to multiple locations?

Post by fmphoto »

xbytor:

Just tried the master batch action and it did not work for me at all. What I did was create an action for 900x900 and 500x500. Then I create a new action and while recording, played both the 900x900 action and the 500x500 to create a new action. I then ran this action, and on the 500x500 part, it says image size not available, save not available, and close not available.

Are these improper steps to recording the action?
fmphoto

Batch Resizing multiple sizes to multiple locations?

Post by fmphoto »

In what program do I start editing the script and how do I save it as a .jsx file? Like I said, I'm totally new and have no real idea of how to get started or what to do. Thanks.
Mike Hale

Batch Resizing multiple sizes to multiple locations?

Post by Mike Hale »

X, did you notice that he wants to resize an image 6 times and save each size in it's own folder?

I know that you can override the naming in a batch but how do you get each action of the master action to save in a subfolder and still override the name used to save the file?
Patrick

Batch Resizing multiple sizes to multiple locations?

Post by Patrick »

fmphoto wrote:In what program do I start editing the script and how do I save it as a .jsx file? Like I said, I'm totally new and have no real idea of how to get started or what to do. Thanks.

Photoshop installs a program called Extendscript Toolkit that you can use for editing scripts. You can just paste what I posted into a text editor and save as whatever.jsx. To load it in Photoshop, you do file > automate > open script and point it to your jsx file.

Also, if you look in your photoshop folder, there are some PDF documents on scripting that are very helpful when you are starting out.

Patrick