Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

Re: Script or Action - Make image square

$
0
0

Hopefully this will help someone down the road...here is my final script that works in batch mode from bridge:

 

var startColor = app.backgroundColor;

    if(startColor.rgb.hexValue != 'FFFFFF'){

        var white = new SolidColor();

        white.rgb.hexValue = 'FFFFFF';

        app.backgroundColor = white;

    }

 

var savedRuler= app.preferences.rulerUnits;

app.displayDialogs = DialogModes.NO;

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;

 

if(white != undefined) app.backgroundColor = startColor; 


Viewing all articles
Browse latest Browse all 27456

Trending Articles