Skip to main content
Known Participant
February 7, 2014
Question

(CC) Save all Layer Masks as Alpha Channels

  • February 7, 2014
  • 3 replies
  • 2476 views

Hello,

I've looked everywhere and can't seem to find a script to do this. I am looking for a script to simply check every layer for a layer mask and if there is one, save it as an alpha channel. The layers may or may not be in groups. No need to delete the masks, just save them as alpha channels. I have a lot of images with a lot of masks and it's a pain trying to save them manually! I thought this would be pretty easy but from what I've been reading this might be a little over my head. I would really appreciate any assistance!

Thank you in advance,

Danny

This topic has been closed for replies.

3 replies

c.pfaffenbichler
Community Expert
Community Expert
February 7, 2014

In this thread the task was to save Layer Masks as separate files, you may be able to adapt the Script …

http://ps-scripts.com/bb/viewtopic.php?f=9&t=5683&sid=e925a8f83fd8f7386ff34805ec78ca56

JJMack
Community Expert
Community Expert
February 7, 2014

Any such script would fail with a error once it tried to exceed Photoshop 53 Alpha Channel limit.  If a document had 53 alpha channels to begin with the script would fail saving the first alpha channel it would try to save.  I know this for a have a script that tries to create my kind of collage template PSD files that has no Image layers but has alpha channels to map the locations where images will be populated.  I had to program the script to catch that there were more the 53 prototype image layers.

IMO with the exception of the background layer all layers have Alpha Channel its actual pixel map. This invisible Alpha channel maps the layers actual pixels locations and is used in conjunction with any enable layer masks when pixels are rendered for the layer.  What I was trying to do was to create a collage template that had Alpha channel to map the locations of where Image would be placed. . I would open a document the size and resolution I wanted the collage to have. Then add an empty layer the use a selection tool to make a 4"x6" selection and fill with pixels..  Duplcate that layer for as many image I wanted. And I would position the layer where I want the image to be located.  I would then  run the script.  It would save Alpha channels for each image location and at the end flatten the layer image prototype stack to stamp the image locations onto the required background layer.  Once I reached 54 image layers  the script failed and I realized that my Collage Scripts and templates were limited to a maximum of 53 images.

JJMack
c.pfaffenbichler
Community Expert
Community Expert
February 7, 2014

Good point about the limit of channels, I seldom work with larger numbers of additional channels do I had not considered that.

JJMack
Community Expert
Community Expert
February 7, 2014

Layer Mask and Alpha channels are more or less the same thing.  However only the current  active layer's layer mask is shown in the Channels palette. Other layers Layer masks are not displayed there however they exists but just not listed in the Channels palette for they are shown in the layers palette.  You can have something like up to 8,000 layers in a Photoshop document so up to 8,000 layer mask.  You could only duplicate up to 53 of them as named Alpha Channels for Photoshop limits you to 53 Alpha channels in a document.

JJMack
Chuck Uebele
Community Expert
Community Expert
February 7, 2014

First of all, why would you want to do this?  The layer masks are saved with the layer, so you're just increasing your file size.

StrongBeaver
Legend
February 11, 2014

And to think I was looking for script ideas, thanks alot csuebele.

c.pfaffenbichler
Community Expert
Community Expert
February 11, 2014

And to think I was looking for script ideas, thanks alot csuebele.

I’m afraid I don’t quite understand the emoticons’ meaning here – is this meant sarcastically?