Batch Canvas and Image Resizer

10 May 2020 by Michael S. White

I found myself in a situation where I needed to take hundreds of images and put white borders around them - either on the L/R sides or Top/Bottom - and make them all the same sizes. In my case, I needed to have the final images be a square rather than rectangular. Doing this manually within Photoshop would be tedious to say the least.

A quick web search turned up a couple scripts that did part of what I was needing to do, but none fully was up to the task. Again, it was a quick search. I started digging into the code that was in a couple scripts that I found and figured I could just make my own.

Visual of the Resize Canvas user interface
Resize Canvas dialog

Key Requirements

  1. Select a folder that contained 1-n images as the source
  2. Select a folder that the output would save the images
  3. Be able to input width and height dimensions in pixels
  4. Set the Anchor Position for resizing the canvas
  5. Set the Canvas Extension Color to white*.
  6. Adjust the output JPEG Quality Level.
  7. Quickly process the images in the Source folder.

* Currently, white is the default Canvas Extension Color. Plan is to incorporate options into the script interface for color selection.

Download the Script

resize_to_1200x1200.js.zip

About the Script

Script Name

You may ask why the file name for the script is 'Resize_to_1200x1200' rather than something more descriptive of what the script does. Well, I initially needed something that would create a square with 1200x1200 dimensions and those dimensions were hard-coded into the script. As development progressed, I just kept the name.

Using the Script

To quickly run the script:

  1. Download the file to your local computer.
  2. Unzip the downloaded file.
  3. In Photoshop, File -> Scripts -> Browse...
  4. In the dialog box, navigate to the location where you unzipped the script and press Open.
  5. In the Resize Canvas window, fill out the different options and press the Okay button.
  6. When finished, you will be alerted indicating the number of images processed.

If you want to add the script to your Scripts menu and you are using a Mac:

Credits and Inspiration