F
F
fuzzZy232017-06-01 11:31:10
JavaScript
fuzzZy23, 2017-06-01 11:31:10

How to make square images in bulk using Photoshop?

Hello.
It is necessary to make a square image out of a rectangular image, by enlarging it with a white background, and not cropping it.
This script fits.

var savedRuler= app.preferences.rulerUnits;  
app.preferences.rulerUnits = Units.PIXELS;  
var w = app.activeDocument.width;  
var h = app.activeDocument.height;  
if(w>h) app.activeDocument.resizeCanvas (w, w, AnchorPosition.MIDDLECENTER);  
if(w<h) app.activeDocument.resizeCanvas (h, h, AnchorPosition.MIDDLECENTER);  
//if w==h already square  
app.preferences.rulerUnits = savedRuler;

Question:
There are more than 600 pictures. How to run a script in bulk for a folder?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Lysenko, 2017-06-01
@fuzzZy23

There is such a thing as batch processing photos through a Photoshop droplet. Google it as one of the options.

F
fuzzZy23, 2017-06-01
@fuzzZy23

Solving the problem:
1. Create a script in a text file (copy the code into it):

var savedRuler= app.preferences.rulerUnits;  
app.preferences.rulerUnits = Units.PIXELS;  
var w = app.activeDocument.width;  
var h = app.activeDocument.height;  
if(w>h) app.activeDocument.resizeCanvas (w, w, AnchorPosition.MIDDLECENTER);  
if(w<h) app.activeDocument.resizeCanvas (h, h, AnchorPosition.MIDDLECENTER);  
//if w==h already square  
app.preferences.rulerUnits = savedRuler;

Save the file with the .js extension
2. Add the script to Photoshop (you can easily google the path where the Scripts folder is located
3. Run photoshop, open the picture you want to change. Next Window>Operations. Create and save the Action (the sequence of actions that will later
4. Based on this Action, create a Droplet. Thanks
guys for the tip.
In YouTube, type: "Create a droplet in Photoshop for batch processing photos
. "

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question