Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save macgraphic/aa9f76089275db2e73376259203226de to your computer and use it in GitHub Desktop.
Save macgraphic/aa9f76089275db2e73376259203226de to your computer and use it in GitHub Desktop.
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;
@macgraphic
Copy link
Author

Script to run in Photoshop.
Sets images to square, based on longest side.
Best used with images with white, or solid background - remember to set same background colour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment