: Batch processing images to be proportional I have a series of small images, all on white backgrounds. Some of them are square proportioned, others are rectangular proportioned; either vertically
I have a series of small images, all on white backgrounds.
Some of them are square proportioned, others are rectangular proportioned; either vertically or horizontally. I'm looking to make all all of the images square, the size doesn't matter but the proportion does.
Is there a quick way to batch process all images so that it turns rectangular images into squared images while keeping them centered and also ignoring images that are already square?
I'd try a macro or script, but I don't know how to code something like: "make the image and bigger at its biggest side".
I'm working with Photoshop but I can upload the images to any online tool if needed.
More posts by @Kaufman565
1 Comments
Sorted by latest first Latest Oldest Best
I won't go into detail about the batch process. It should be enough to know that you can run a script through the File > Automate > Batch... by first making a Photoshop Action, where you open a script file: File > Scripts > Browse.... Obviously you can also do more things within that same Action.
I'm not exactly confident I understand what you want, so I'm posting 2 scripts. Make a new .jsx file where you paste one of these scripts and use that in the action.
These both work with portrait and landscape images.
Image to square - Shrink script.jsx:
var rUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var doc = app.activeDocument;
var docWidth = doc.width;
var docHeight = doc.height;
var newSize = docWidth > docHeight ? docHeight : docWidth;
app.activeDocument.resizeCanvas( newSize, newSize, AnchorPosition.MIDDLECENTER );
app.preferences.rulerUnits = rUnits;
Image to square - Grow script.jsx:
The extended background color comes from the background color set in the toolbar.
var rUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var doc = app.activeDocument;
var docWidth = doc.width;
var docHeight = doc.height;
var newSize = docWidth > docHeight ? docWidth : docHeight;
app.activeDocument.resizeCanvas( newSize, newSize, AnchorPosition.MIDDLECENTER );
app.preferences.rulerUnits = rUnits;
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.