Skip to main content
Participating Frequently
October 1, 2021
Question

How to export layers to files with an applied clipping mask

  • October 1, 2021
  • 2 replies
  • 1457 views

Hi,

 

I am trying to figure out how to export multiple layers with an applied clipping mask. For example I have the words January - December all on their own layers and grouped within a folder. I applied a clipping mask to these words and want to export each month name with the applied clipping mask with a transparent PNG background and have it trim the layers.

 

I explored the "Layers to Files" function but that will only export the individual layers, which is great but it doesn't apply the clipping mask to each layer as well.

 

Is there a way to export the layers to files (transparent PNG + trim layers) and each layer with the applied clipping mask?

 

In image 1, shows my clipping mask on the top above the grouped months

 

In image 2, is what I want each exported layer for January to December to look like, but with a transparent background (PNG) and for it to trim the layer to its size.

 

Is this possible to do in PS or with a script? I haven't used a script in PS before so I don't know how to write them. But I have researched how to run a script.

 

I appreciate any help! TIA!!

This topic has been closed for replies.

2 replies

Bojan Živković11378569
Community Expert
Community Expert
October 2, 2021

You can also experiment with Window > Layer Comps and Export > Layer Comps to Files what will do the trick to include clipped content. Perhaps some script to create layer comps with clipped layer + single layer in the group is doable. 

Stephen Marsh
Community Expert
Community Expert
October 2, 2021

@Bojan Živković11378569 – Good suggestion!

 

Including the clipped content is half of the main challendge, the other half of the main challenge is trimming to pixel content to remove the canvas size transparency.

 

It would still be quicker to manually make 12 layer comps, export them to png24 – then run a second pass batch action to simply trim to transparency and resave, than to create a custom script.

Participating Frequently
October 4, 2021

@Stephen Marsh the example shown is 12 images, but I would actually have 50 images I would have to export and even more when I change my image used for clipped mask.

Stephen Marsh
Community Expert
Community Expert
October 2, 2021

I have looked around my collection of scripts and I don't have anything that will work with what I can see of your layer structure.

 

You'll need transparency in the source file, I'm not sure why you have a white background as the upper clipped layer should have the transparency of the text with the fill of the clipped layer.

 

You can easily semi-automate this with an action for many of the steps. If this is only 12 images and you need to do it once, there is little point in full automation as it will take longer to setup the automation than just doing this manually.

 

 

Participating Frequently
October 4, 2021

Hi Stephen,

 

The image above shows a white background for contrast. I turned the background layer on for the screenshot so you can see the image better.

 And in the future, it would actually be 50 images that I would do multiple times as I switch out the image for the clipped mask.

Stephen Marsh
Community Expert
Community Expert
October 4, 2021

OK, this would warrant the extra effort to create a script.

 

Can you please share a cropped screenshot of the layers panel, with only the required layes used in production (no need for any extras to provide visual contrast as I am only interested in the layer structure).

 

For ongoing use, would anything change in the future in the layer structure, such as the order of layers/groups or names? I understand that there may be more or less layers, presumably in the group.