Have a layer resize script, but need it to work when layer is great than 550px


hi,

 

i've luckily found script layer resize needed. thing is, want script deploy if current layer greater 550px - existing code script below:

 

 (function (){     var startrulerunits = app.preferences.rulerunits;       app.preferences.rulerunits = units.pixels;     var bounds = activedocument.activelayer.bounds;       var width = bounds[2].value - bounds[0].value;     var newsize = (100 / width) * 550;       activedocument.activelayer.resize(newsize, newsize, anchorposition.bottomleft);     app.preferences.rulerunits = startrulerunits;   })(); 

 

if can explain how can use if function, appreciated!

 

many in anticipation.

(function (){ 
    var startrulerunits = app.preferences.rulerunits;   
    app.preferences.rulerunits = units.pixels; 
    var bounds = activedocument.activelayer.bounds;   
    var width = bounds[2].value - bounds[0].value; 
    if(width > 550){
    var newsize = (100 / width) * 550;   
    activedocument.activelayer.resize(newsize, newsize, anchorposition.bottomleft); 
    }
    app.preferences.rulerunits = startrulerunits;   
})(); 


More discussions in Photoshop Scripting


adobe

Comments

Popular posts from this blog

Adobe Refresh Managerについて

Sizing images of multiple resolutions for print on a page of one resolution

Illustrator cs6 "Invalid Serial Number"