Hi!
I want to transform a layer into an alpha channel, ignoring the layer's color information (treating it as if it had been converted to greyscale).
In theory this would be achieved by copying the layer to the clipboard, switching to quick mask mode, pasting the clipboard contents, exiting quick mask mode and making a channel from the selection. This is scripted fairly easy and I've already done so. The problem is when the origin layer does not fill the document bounds, resulting in the infamous pasting shift. I'm currently trying to correct this shift, but before I put more time and effort into this, I wanted to know if someone has come up with a simpler solution. Or if there is some command I have overlooked.
Thanks!
Saving a Layer as a Channel
Saving a Layer as a Channel
You could turn off all the other layers. Use scriptlistener to load the composite channel( luminosity ) as a selection. Save that selection as a channel. Then turn on the other layers.
Saving a Layer as a Channel
What do you mean by "load the composite channel (luminosity ) as a selection"?
Saving a Layer as a Channel
When you ctrl-click on the rgb channel Photoshop loads the document's luminosity as a selection. Below is a sample scriptlistener output. Note if the document you are working with is not rgb you will need to get the code for that mode from the scriptlistener plug-in.
Code: Select all var desc79 = new ActionDescriptor();
var ref60 = new ActionReference();
ref60.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "RGB " ) );
desc79.putReference( charIDToTypeID( "null" ), ref60 );
var ref61 = new ActionReference();
ref61.putProperty( charIDToTypeID( "Chnl" ), charIDToTypeID( "fsel" ) );
desc79.putReference( charIDToTypeID( "T " ), ref61 );
executeAction( charIDToTypeID( "Add " ), desc79, DialogModes.NO );
Code: Select all var desc79 = new ActionDescriptor();
var ref60 = new ActionReference();
ref60.putEnumerated( charIDToTypeID( "Chnl" ), charIDToTypeID( "Chnl" ), charIDToTypeID( "RGB " ) );
desc79.putReference( charIDToTypeID( "null" ), ref60 );
var ref61 = new ActionReference();
ref61.putProperty( charIDToTypeID( "Chnl" ), charIDToTypeID( "fsel" ) );
desc79.putReference( charIDToTypeID( "T " ), ref61 );
executeAction( charIDToTypeID( "Add " ), desc79, DialogModes.NO );
Saving a Layer as a Channel
Indeed, loading the composite channel as a luminosity selection is a far easier route than what was described in the original post. I think you can accomplish what with want with an action rather than a script. I've made one that you can download herehttp://www.mattkeyes.com/filedelivery/ps_scrip ... hannel.zip. Just select the layer that you want to make a channel of, and run the action, it will hide all other layers, load the composite channel as a selection, make a channel of that selection, and then duplicate that channel into a new document. It will also invert the channel, you may want this, you may not depending on how you have your channel, and quick mask preferences set up. The only conflict you might run into is if you have other channels in the the document that are already named "Alpha 1". This should give you an idea of where to go though.
Alternative ways to load the luminosity of the composite channel as a selection: hold ctrl [win] or cmnd [mac] and click on the composite channel -RGB, or CMYK or whatever. Or select the channel and click the "load channel as selection" button on the far left in the channels palette.
Hope one of those works,
Matt
Alternative ways to load the luminosity of the composite channel as a selection: hold ctrl [win] or cmnd [mac] and click on the composite channel -RGB, or CMYK or whatever. Or select the channel and click the "load channel as selection" button on the far left in the channels palette.
Hope one of those works,
Matt