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

I have a need for this script as well...is this the entire script?  If not, can you post the complete script?

 

I just need to increase either the canvas width (as white area for the added width/height) or the canvas height to match the longest side of an image so they they are perfectly square.  No cropping or reduction in image sizes.  These are product images on white background.

 

Is this the full script?

 

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.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



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