Skip to main content
Participating Frequently
June 25, 2016
Answered

Keep all Alpha channels Masked Area.

  • June 25, 2016
  • 2 replies
  • 621 views

Hi,
In my every files, I have 50 more alpha channels for future color adjustments and in that some alpha channels are in "masked area" and some channels are in "selected area". I want to make each channel type as "masked area". Is there any script to make all the alpha channels to be selected as "masked area"?

Thank you

This topic has been closed for replies.
Correct answer SuperMerlin

#target photoshop;

if(documents.length){

if(activeDocument.componentChannels.length != activeDocument.channels.length){

var chanlen = activeDocument.componentChannels.length;

var chantotal = activeDocument.channels.length;

for( var a = chanlen;a<chantotal;a++){

    if(activeDocument.channels.kind == ChannelType.SELECTEDAREA) activeDocument.channels.kind = ChannelType.MASKEDAREA;

    }

    }

};

SuperMerlin
SuperMerlinCorrect answer
Inspiring
June 25, 2016

#target photoshop;

if(documents.length){

if(activeDocument.componentChannels.length != activeDocument.channels.length){

var chanlen = activeDocument.componentChannels.length;

var chantotal = activeDocument.channels.length;

for( var a = chanlen;a<chantotal;a++){

    if(activeDocument.channels.kind == ChannelType.SELECTEDAREA) activeDocument.channels.kind = ChannelType.MASKEDAREA;

    }

    }

};

cakunderAuthor
Participating Frequently
June 27, 2016

Thank you very much Merlin. . It works fine.

JJMack
Community Expert
Community Expert
June 25, 2016

Alpha channels, Filter Mask, Layer mask and selections are all selection. The are the same thing just stored in different areas. You can for example load an alpha channel as a selection and click on the add layer mask icon in the layers palette and it will be added to the current target layer or layer group as a layer mask, or if you add a smart filter the current selection will be added  as a filter mask, or if you add an adjustment layer the current selection will be added to the adjustment layer as a layer mask even if you have set the option not to add a layer mask when you add a adjustment layer.  Also be careful Photoshop only support  53 alpha channels.  50 is close to Photoshop limit.  If you try to create a 54th Alpha Channel you will find you can not.

To answer your question your script would would need to know which of you 50 Alpha Channels you want to use to mask an area when you want to work on an area. My Photo Collage Toolkit collage populating scripts use the Alpha Channels in my Collages Templates for a few things.  I use the bounds of an alpha channel for resizing images, use the alpha chanel area  for positioning the resized image and the alpha channel shape for masking the positioned resized image to shape.  My Collage Templates require Alpha Channels named Image 1,  Image 2, ..., Image N. to Map where Image are positioned, sized to and shaped to. My type of collage templates are very easy to create there is no complex layer structure requires, Layers are not use as image place holders or models, No Clipping mask etc are required.  My Script use the Alpha channels to do all that composting stuff.

Some template creating Scripts will use all the Image Alpha Channels together for creating Mats. All Image Alpha channels are loaded as a single selection to cut holes into a Mat layer that is being created.

As for "selected area" vs "masked area" one is the inverse of the other.  I have never use channel type in scripting only Alpha channels names.  I know for  what purpose I created the Alpha Channel Name for and can always use inverse if I need to.  To me  ( "selected area"  "masked area"  ) is from ones point of view which inverse are does one want to effect.  If I save an inverted section for a because the background was easer to select than the object.  The Alpha channels is for the object.   I would not know if the channel would be  ( "selected area" or "masked area") according to Photoshop I know for what purpose I saved the Alpha channel. I use alpha channels by name.

JJMack
cakunderAuthor
Participating Frequently
June 27, 2016

Thank you for your time SIr