Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Script or Action - Make image square

$
0
0

Need to add this to an action, rather than making all images square manually before batching them all.

 

- All 500+ images are various sizes both portait, landscape and possibly square already.

- They are all cropped tightly around the product with a white background.

 

So currently: I just use canvas size, anchor to the centre and change the smallest pixel dimension to make it square, so none of the product is cropped.

 

Any ideas?

 

I couldn't get JJMack's aspect ratio script to help me.

Automate -> Fit Image will take it to 1000 pixels but still won't be square.

 

 

EDIT: Oh my. I just found this, looks like it'll do the job. Will test some more in the morning.

 

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;


Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>