Hello such. my question is.
Is it possible to apply adjustment layers? Anyway, I have a code in which I need no adjustment layers. How I can do so that the layers are aplied and then delete the adjustment layers?
Would have to be from the bottom up, for if there were multiple adjustment layers. Adjustment layers could have masks (raster always)
I can not think how.
Could anyone help me please?
thanks in advance
regards
apply adjustment layers?
-
pfaffenbichler
apply adjustment layers?
Supposing there are two pixel Layers beneath one or more Adjustment Layers I assume you would want the Adjustment/s to be applied to all those Layers?
That might get fairly complicated, especially if Groups are involved that might have Blend Modes other than »Pass Through«.
Edit: Actually it might not be so bad, after all … but depending on the image such a Script might take a long time to run.
That might get fairly complicated, especially if Groups are involved that might have Blend Modes other than »Pass Through«.
Edit: Actually it might not be so bad, after all … but depending on the image such a Script might take a long time to run.
-
Paul MR
apply adjustment layers?
I don't understand what you mean by apply then delete the adjustment layer, but if you what to merge them down this should do it...
Code: Select allmain();
function main(){
if(!documents.length) return;
var aLayers = getAdjustmentLayers();
for(var a in aLayers){
selectLayerById(Number(aLayers[a][0]));
//do whatever you want to this layer
try{activeDocument.activeLayer.merge();}catch(e){}
}
};
function getAdjustmentLayers(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
var count = executeActionGet(ref).getInteger(charIDToTypeID('NmbL')) +1;
var Names=[];
try{
activeDocument.backgroundLayer;
var i = 0; }catch(e){ var i = 1; };
for(i;i<count;i++){
if(i == 0) continue;
ref = new ActionReference();
ref.putIndex( charIDToTypeID( 'Lyr ' ), i );
var desc = executeActionGet(ref);
var layerName = desc.getString(charIDToTypeID( 'Nm ' ));
var vMask = desc.getBoolean(stringIDToTypeID('hasVectorMask' ));
var Id = desc.getInteger(stringIDToTypeID( 'layerID' ));
if(layerName.match(/^<\/Layer group/) ) continue;
if(desc.hasKey(stringIDToTypeID('adjustment')) && !vMask) Names.push([[Id],[layerName]]);
};
return Names;
};
function selectLayerById(ID, add) {
add = (add == undefined) ? add = false : add;
var ref = new ActionReference();
ref.putIdentifier(charIDToTypeID('Lyr '), ID);
var desc = new ActionDescriptor();
desc.putReference(charIDToTypeID('null'), ref);
if (add) {
desc.putEnumerated(stringIDToTypeID('selectionModifier'), stringIDToTypeID('selectionModifierType'), stringIDToTypeID('addToSelection'));
}
desc.putBoolean(charIDToTypeID('MkVs'), false);
executeAction(charIDToTypeID('slct'), desc, DialogModes.NO);
};
Code: Select allmain();
function main(){
if(!documents.length) return;
var aLayers = getAdjustmentLayers();
for(var a in aLayers){
selectLayerById(Number(aLayers[a][0]));
//do whatever you want to this layer
try{activeDocument.activeLayer.merge();}catch(e){}
}
};
function getAdjustmentLayers(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
var count = executeActionGet(ref).getInteger(charIDToTypeID('NmbL')) +1;
var Names=[];
try{
activeDocument.backgroundLayer;
var i = 0; }catch(e){ var i = 1; };
for(i;i<count;i++){
if(i == 0) continue;
ref = new ActionReference();
ref.putIndex( charIDToTypeID( 'Lyr ' ), i );
var desc = executeActionGet(ref);
var layerName = desc.getString(charIDToTypeID( 'Nm ' ));
var vMask = desc.getBoolean(stringIDToTypeID('hasVectorMask' ));
var Id = desc.getInteger(stringIDToTypeID( 'layerID' ));
if(layerName.match(/^<\/Layer group/) ) continue;
if(desc.hasKey(stringIDToTypeID('adjustment')) && !vMask) Names.push([[Id],[layerName]]);
};
return Names;
};
function selectLayerById(ID, add) {
add = (add == undefined) ? add = false : add;
var ref = new ActionReference();
ref.putIdentifier(charIDToTypeID('Lyr '), ID);
var desc = new ActionDescriptor();
desc.putReference(charIDToTypeID('null'), ref);
if (add) {
desc.putEnumerated(stringIDToTypeID('selectionModifier'), stringIDToTypeID('selectionModifierType'), stringIDToTypeID('addToSelection'));
}
desc.putBoolean(charIDToTypeID('MkVs'), false);
executeAction(charIDToTypeID('slct'), desc, DialogModes.NO);
};
-
Mike Hale
apply adjustment layers?
I also don't understand what you are trying to do.
If you just want to apply an adjustment to a layer you could use scriptlistener code to make the adjustment to the layer and skip making a new adjustment layer. You should be able to use any adjustment that is found the the Image-Adjustments sub-menu. That should be faster than creating a new adjustment layer.
The only advantage I can see to using an adjustment layer this way is if there is transparent areas in some of the layers it would apply the adjustment to more than one layer. But at the cost of flattening the layers.
If you just want to apply an adjustment to a layer you could use scriptlistener code to make the adjustment to the layer and skip making a new adjustment layer. You should be able to use any adjustment that is found the the Image-Adjustments sub-menu. That should be faster than creating a new adjustment layer.
The only advantage I can see to using an adjustment layer this way is if there is transparent areas in some of the layers it would apply the adjustment to more than one layer. But at the cost of flattening the layers.
-
buga
apply adjustment layers?
Sorry that I have not explained well, I'm Spanish.
I'll try to explain better.
What I want to do is merge adjustment layers, but to all layers. As if I had used the settings on the layers and not as an adjustment layer.
The problem is that the script should be used on all layers of the document that are below the adjustment layer.
And guess, should be done from bottom to top (in case there several adjustment layers in the document)
is a bit complicated to explain in English.
Excuse
Greetings and thank you very much
I'll try to explain better.
What I want to do is merge adjustment layers, but to all layers. As if I had used the settings on the layers and not as an adjustment layer.
The problem is that the script should be used on all layers of the document that are below the adjustment layer.
And guess, should be done from bottom to top (in case there several adjustment layers in the document)
is a bit complicated to explain in English.
Excuse
Greetings and thank you very much
-
Paul MR
apply adjustment layers?
Isn't that the same as ...
Code: Select allactiveDocument.mergeVisibleLayers();
Code: Select allactiveDocument.mergeVisibleLayers();
-
buga
apply adjustment layers?
I know that command, but I want to preserve the structure of the layers separately.
Thanks
regards
Thanks
regards
-
pfaffenbichler
apply adjustment layers?
One approach might be hiding all pixel Layers, then showing them again one by one and doing a merge to a new Layer and removing the old one.
While this should take care of LayerSets’ Blend Modes, honoring Clipping Mask Groups and Layer Masks would complicate the matter.
While this should take care of LayerSets’ Blend Modes, honoring Clipping Mask Groups and Layer Masks would complicate the matter.
-
pfaffenbichler
apply adjustment layers?
Just noticed that the original poster’s request has issues.
For example an Adjustment Layer that affects the mid-tones set above a semi-transparent black Layer would cause an effect in the original layered file but when merged to the Layer it would not.
For example an Adjustment Layer that affects the mid-tones set above a semi-transparent black Layer would cause an effect in the original layered file but when merged to the Layer it would not.