Photoshop: Scale Effects on multiple layers at the same time

  • 6
  • Idea
  • Updated 12 months ago
  • (Edited)
I would love the ability to highlight multiple layers in the Layers Panel, then use Scale Effects to alter the sale on only the highlighted layers.

Currently to scale effects the operation must be done layer by layer. There is no method (at least that I'm aware of) to scale effects on more than one layer at the same time, short of using Image Size to change the size of the document. This necessitates a repeated process of control-click, scale effects, set sale, hit okay, highlight next layer, control-click, scale effect, enter value, hit okay, highlight next layer, control-click, scale effects, enter value, hit okay...... etc. Using an Action makes it easier, but there's still the need to repeatedly highlight layers in the layers panel and then run an action.

It would be exceptionally handy to simply command or shift-click multiple layers and choose Scale Effects and scale them all at one time.

I'm aware that image size will scale effects if desired. But That's not a great deal of help if I have a file containing 75 layers, 60 of which have effects applied, and I want to scale the effects on only 32 layers.

I also realize I could copy those 30 layers to a new file, scale via image size then copy the layers back, but this makes a mess of a well organized layer stack and doesn't offer the ability to see, dynamically, how the effects are scaling. This method requires a great deal of trial and error to get things scaled correctly.
Photo of Scott W

Scott W

  • 41 Posts
  • 1 Reply Like
  • happy

Posted 6 years ago

  • 6
Photo of Paul Riggott

Paul Riggott

  • 359 Posts
  • 142 Reply Likes
Please try this Scott...



#target Photoshop
app.bringToFront();
main();
function main(){
if(!documents.length) return;
var win = new Window('dialog','Scale Effects');
g = win.graphics;
var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.99, 0.99, 0.99, 1]);
g.backgroundColor = myBrush;
win.orientation='stack';
win.p1= win.add("panel", undefined, undefined, {borderStyle:"black"});
win.g1 = win.p1.add('group');
win.g1.orientation = "row";
win.title = win.g1.add('statictext',undefined,'Scale Effects');
win.title.alignment="fill";
var g = win.title.graphics;
g.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);
win.g5 =win.p1.add('group');
win.g5.orientation = "row";
win.g5.alignment='fill';
win.g5.spacing=10;
win.g5.st1 = win.g5.add('statictext',undefined,'Enter Scale Value');
win.g5.et1 = win.g5.add('edittext',undefined,'100');
win.g5.et1.preferredSize=[60,20];
win.g5.et1.onChanging = function() {
if (this.text.match(/[^\-
#target Photoshop
app.bringToFront();
main();
function main(){
if(!documents.length) return;
var win = new Window('dialog','Scale Effects');
g = win.graphics;
var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.99, 0.99, 0.99, 1]);
g.backgroundColor = myBrush;
win.orientation='stack';
win.p1= win.add("panel", undefined, undefined, {borderStyle:"black"});
win.g1 = win.p1.add('group');
win.g1.orientation = "row";
win.title = win.g1.add('statictext',undefined,'Scale Effects');
win.title.alignment="fill";
var g = win.title.graphics;
g.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);
win.g5 =win.p1.add('group');
win.g5.orientation = "row";
win.g5.alignment='fill';
win.g5.spacing=10;
win.g5.st1 = win.g5.add('statictext',undefined,'Enter Scale Value');
win.g5.et1 = win.g5.add('edittext',undefined,'100');
win.g5.et1.preferredSize=[60,20];
win.g5.et1.onChanging = function() {
if (this.text.match(/[^\-\.\d]/)) {
this.text = this.text.replace(/[^\-\.\d]/g, '');
}
};
win.g50 =win.p1.add('group');
win.g50.orientation = "row";
win.g50.alignment='fill';
win.g50.spacing=10;
win.g50.bu1 = win.g50.add('button',undefined,'Process');
win.g50.bu1.preferredSize=[100,25];
win.g50.bu2 = win.g50.add('button',undefined,'Cancel');
win.g50.bu2.preferredSize=[100,25];
win.g50.bu1.onClick=function(){
if(win.g5.et1.text == ''){
alert("No scale value has been entered!");
return;
}
win.close(0);
var Scale = Number(win.g5.et1.text);
var selectedLayers=getSelectedLayersIdx();
for(var a in selectedLayers){
if( hasEffects(Number(selectedLayers[a]))){
selectLayerByIndex(Number(selectedLayers[a]));
scaleEffects(Scale);
}
}
for(z in selectedLayers) {
selectLayerByIndex(Number(selectedLayers[z]),true);
}
}
win.center();
win.show();
};
function scaleEffects(Scale) {
var desc = new ActionDescriptor();
desc.putUnitDouble( charIDToTypeID('Scl '), charIDToTypeID('#Prc'), Scale );
executeAction( stringIDToTypeID('scaleEffectsEvent'), desc, DialogModes.NO );
};
function getSelectedLayersIdx(){
var selectedLayers = new Array;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
var desc = executeActionGet(ref);
if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){
desc = desc.getList( stringIDToTypeID( 'targetLayers' ));
var c = desc.count
var selectedLayers = new Array();
for(var i=0;i
Photo of Paul Riggott

Paul Riggott

  • 359 Posts
  • 142 Reply Likes
By the way you can select a range of layers as it will only try to scale effects if the layer does have effects.
Photo of Scott W

Scott W

  • 41 Posts
  • 1 Reply Like
Thanks Paul! Unfortunately ...

Error 8: Syntax Error.
Line: 26
-> if (this.text.match(/[^\-
Photo of Paul Riggott

Paul Riggott

  • 359 Posts
  • 142 Reply Likes
That line should be correct Scott, maybe the script is getting corrupted on the forum? Could you please try this..
http://www.scriptsrus.talktalk.net/do...
Photo of Scott W

Scott W

  • 41 Posts
  • 1 Reply Like
Thanks Paul!

It must have been something with the copy/paste (although I did check for invisibles). Your download works perfectly.

Not quite what I'm after but your script is absolutely better than any current method available. I really appreciate you taking the time! Have faith.. I'll use this script daily.. many, many times until hopefully the DEV team implements something on their own :)

Thanks again!
Photo of Max Johnson

Max Johnson, Champion

  • 434 Posts
  • 202 Reply Likes
Bump.
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14049 Posts
  • 1735 Reply Likes
You don't need to "Bump" a thread. Simply click the Me Too to add your vote. Thanks.
Photo of Jaroslav Bereza

Jaroslav Bereza

  • 763 Posts
  • 157 Reply Likes
Good news! I made perfect script which can resize styles as you transform layers. http://bereza.cz/ps/#transformStyle

Photo of Max Johnson

Max Johnson, Champion

  • 432 Posts
  • 198 Reply Likes
Once again, you are my hero.