1

I want to batch resize around 1000 images of different sizes (below and above 740px) and resolutions(DPI/PPI). I want to keep the native DPI/PPI but I want to resize them to 740pxx740px with white crops. Here's an example of what I want the output to look like:

Horizontal

Vertical

I've had a lot of trouble doing this with Photoshop CC 2018's Automate > Batch setting. Can anyone help me out with this?

3 Answers 3

3

A good alternative to doing this in PS would be Imagemagick. There are many tutorials out there if you're not exactly sure how to use it.

The code below should do what you want. You'd only have to change the input and output paths to match existing folders. In the code output path points right next to the input file wherever it is. In this case: ~/Desktop/input/ and ~/Desktop/output/.

Just make sure the output folder exists...

You should also probably make sure input folder doesn't have anything besides the images you want to resize, or change -format to -format jpg *.png, in which case the output format would be jpg and the input format would be png.

cd ~/Desktop/input/

mogrify \
  -path "../output" \
  -resize '730x730>' \
  -gravity 'center' \
  -extent '730x730' \
  -quality 100 \
  -background 'white' \
  -format jpg *
0

Hm, I was sure I saw a way to automate this with GUI, maybe that exists in Bridge? Anyway, you can include this Photoshop script into your batch Action:

var doc = activeDocument;
var w = doc.width.as('px');
var h = doc.height.as('px');

if (w > h)
{
  doc.resizeCanvas(undefined, new UnitValue(w, 'px'));
} else {
  doc.resizeCanvas(new UnitValue(h, 'px'), undefined);
}

doc.resizeImage(new UnitValue(740, 'px'));

This will resize document canvas to square. Note that background color will be used for added area, you might want to set it to the color you want first.

0

In short:

  • The key part of the workflow is the "Fit Image…" command (found under the File > Automate)
  • Use it within an action, with some other steps, as outlined below
  • Apply the action to your batch of images

The action

Open a sample image and then record a Photoshop action using this series of steps:

  1. Choose Fit Image command using 742 x 742 as dimensions (2px bigger than final*)
  2. Image > Canvas size… and enter 740 for width and height, and for "Canvas extension color" pick white
  3. Stop recording the action

Now you should open 2 or 3 more images in your collection and run the action to check it works as expected. Your tests should include both landscape and portrait orientations.

Last part of the process is to use: File > Automate > Batch… on your folder of images. I would set "Destination" to folder, so as not to overwrite your originals.


*Why 742 in the "Fit image" step? Unless the number in the "Canvas size" step is different to the "Fit image" step, the action won't record new width and height. It will only record the dimension that changed: width or height.

I'm using Photoshop 2020, but I'm sure it's similar in 2018 version.

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.