load alpha channels convert selection to layer
load alpha channels convert selection to layer
Hi
The Mike Hale script works really fine, but I would ask if is possible to perform a "copy" of each alpha channel into new layer
The problem is quite the same as vbrajan
I have a document with many alpha channel ( each one with a name that i have assigned) and i need to create for each alpha channel an exact copy on a new layer
The steps i'm looking for are:
select alpha channel ,
perform a select all ( of the alpha channel)
copy (the alpha channel)
and past the channel copy into new layer ( with the same alpha channel name)
and loop the same for the other alpha channel in my document
I hope for an help
elen
The Mike Hale script works really fine, but I would ask if is possible to perform a "copy" of each alpha channel into new layer
The problem is quite the same as vbrajan
I have a document with many alpha channel ( each one with a name that i have assigned) and i need to create for each alpha channel an exact copy on a new layer
The steps i'm looking for are:
select alpha channel ,
perform a select all ( of the alpha channel)
copy (the alpha channel)
and past the channel copy into new layer ( with the same alpha channel name)
and loop the same for the other alpha channel in my document
I hope for an help
elen
load alpha channels convert selection to layer
How about this...
Code: Select allfunction copyAlphaToLayer( alphaName ) {
var lyr = app.activeDocument.artLayers.add();
lyr.name = alphaName;
var desc = new ActionDescriptor();
var desc1 = new ActionDescriptor();
var ref = new ActionReference();
ref.putName( charIDToTypeID('Chnl'), alphaName );
desc1.putReference( charIDToTypeID('T '), ref );
desc.putObject( charIDToTypeID('With'), charIDToTypeID('Clcl'), desc1 );
executeAction( charIDToTypeID('AppI'), desc, DialogModes.NO );
return lyr;
};
for( var c = 0; c < app.activeDocument.channels.length;c++ ){
if( app.activeDocument.channels[c].kind == ChannelType.SELECTEDAREA ) {
copyAlphaToLayer( app.activeDocument.channels[c].name );
}
}
Code: Select allfunction copyAlphaToLayer( alphaName ) {
var lyr = app.activeDocument.artLayers.add();
lyr.name = alphaName;
var desc = new ActionDescriptor();
var desc1 = new ActionDescriptor();
var ref = new ActionReference();
ref.putName( charIDToTypeID('Chnl'), alphaName );
desc1.putReference( charIDToTypeID('T '), ref );
desc.putObject( charIDToTypeID('With'), charIDToTypeID('Clcl'), desc1 );
executeAction( charIDToTypeID('AppI'), desc, DialogModes.NO );
return lyr;
};
for( var c = 0; c < app.activeDocument.channels.length;c++ ){
if( app.activeDocument.channels[c].kind == ChannelType.SELECTEDAREA ) {
copyAlphaToLayer( app.activeDocument.channels[c].name );
}
}
load alpha channels convert selection to layer
Hi Mike
thanks for your replay
I'm newbe
I tried the script but He tell me execution finished but nothing happen
Where I'm wrong?
I notice in the script that it perform an "apply Image " and if it is possible I would prefer a " copy" instead
thanks for your replay
I'm newbe
I tried the script but He tell me execution finished but nothing happen
Where I'm wrong?
I notice in the script that it perform an "apply Image " and if it is possible I would prefer a " copy" instead
load alpha channels convert selection to layer
I changed channelType.SELECTEDAREA with channelType.MASKEDAREA and it runs perfectly.
I hope that it will be the chance to use a " Copy" command instead of Apply Image
Thank You again
I hope that it will be the chance to use a " Copy" command instead of Apply Image
Thank You again
load alpha channels convert selection to layer
I used Apply Image because it is faster, shorter, and gives better results than going through the clipboard(copy/paste). Using the clipboard almost always changes the gamma of the channel when pasted into a layer.
However here is one way to copy/paste the alpha channels into layers.
Code: Select allfunction copyAlphaToLayer( alphaChannel ){
var lyr = app.activeDocument.artLayers.add();
lyr.name = alphaChannel.name;
var compChannels = app.activeDocument.activeChannels;
app.activeDocument.activeChannels = [ alphaChannel ];
app.activeDocument.selection.selectAll();
app.activeDocument.selection.copy();
app.activeDocument.selection.deselect();
app.activeDocument.activeChannels = compChannels;
app.activeDocument.paste();
}
var doc = activeDocument;
var lyr = doc.activeLayer;
var cnt = doc.channels.length;
for(var i = 1 ;i < cnt;i++){
if(activeDocument.channels.kind != ChannelType.MASKEDAREA) {continue}
copyAlphaToLayer( doc.channels );
}
However here is one way to copy/paste the alpha channels into layers.
Code: Select allfunction copyAlphaToLayer( alphaChannel ){
var lyr = app.activeDocument.artLayers.add();
lyr.name = alphaChannel.name;
var compChannels = app.activeDocument.activeChannels;
app.activeDocument.activeChannels = [ alphaChannel ];
app.activeDocument.selection.selectAll();
app.activeDocument.selection.copy();
app.activeDocument.selection.deselect();
app.activeDocument.activeChannels = compChannels;
app.activeDocument.paste();
}
var doc = activeDocument;
var lyr = doc.activeLayer;
var cnt = doc.channels.length;
for(var i = 1 ;i < cnt;i++){
if(activeDocument.channels.kind != ChannelType.MASKEDAREA) {continue}
copyAlphaToLayer( doc.channels );
}