Skip to main content
posvar
Known Participant
June 20, 2021
Question

automate batch layer composition & export

  • June 20, 2021
  • 3 replies
  • 3588 views

I'm trying to auto-compose and export 1000s of combinations of layers across multiple layer groups.  I understand I probably need to feed a script to make this work.  I have a PSD file with 8 different LayerGroups.  Each LayerGroup between 1-30 different layers. I want to feed instructions to batch export (PNG) specific combinations.

 

E.g.

Final PNG 1 = LayerGroup 1:layer 3 + LayerGroup 2:layer 7 + ... + LayerGroup 8:layer 87

Final PNG 2 = LayerGroup 1:layer 2 + LayerGroup2:none + ... + LayerGroup 8:layer 94

...

Final PNG 1000 = Layer gruop 1:none + Layer group 2:layer 8 + ... + Layer group 3:layer 92

 

I saw PhotoshopCompositionComposer javascript on GitHub - but it throws an error, I'm working in latest Photoshop 22.4.2 Release.  Any help would be appreciated.

This topic has been closed for replies.

3 replies

Bojan Živković11378569
Community Expert
Community Expert
June 21, 2021

If you can not figure out script be aware that data sets can be used to show/hide layers and layer groups. At least you have alternative solution.

posvar
posvarAuthor
Known Participant
June 21, 2021

what is this feature called? Can PS use a dataset to compose layer combinations and export bulk PNGs?  Where can I read more aobut how to do this? Thanks in advance.

Bojan Živković11378569
Community Expert
Community Expert
June 21, 2021

You can not export PNG files but rather PSD which can be bulk converted to PNG.

 

Here is official help page Create data-driven graphics

 

Here are my tutorials on that topic Easy Way to Automate Photoshop with Variables At the bottom zou have links to more connected tutorials. 

 

 

The Productivity Shop
Participating Frequently
June 21, 2021

@posvar  Are you on a mac or PC? thanks!

posvar
posvarAuthor
Known Participant
June 21, 2021

PC - I just provided a more detailed breakdown of what I'm trying to do in the response above.  I was able to get the PhotoshopCompositionComposer script to work - but it produces every possible combination across the Folders, in my case 89K+ PNGs would be created, taking multiple days of non-stop processing.  I'd prefer an approach where I can instruct the specific ~1K combos I'm targeting.  Thanks in advance.

Legend
June 20, 2021

Without a description of the specific structure, as well as an algorithm for what exactly you want to display in the current PNG, it is hardly possible to solve the problem. Your script seems to leave one visible layer in each folder for the next combination. Not sure if this is what you want. What kind of error does it give? And also give the exact link to the script if you want to fix it.

posvar
posvarAuthor
Known Participant
June 21, 2021

Here's a better understanding of the structure (actual structure has ~8 folders, and ~100 individual layers):

 

Folder 1: HAIR

  • Layer 1: short
  • Layer 2: ponytail
  • Layer 3: medium

Folder 2: GLASSES

  • Layer 4: small
  • Layer 5: aviators
  • Layer 6: sunglasses

Folder 3: MOUTH

  • Layer 7: open
  • Layer 8: closed
  • Layer 9: smile
  • Layer 10: frown

Folder 4: JEWELRY

  • Layer 11: nose ring
  • Layer 12: earring left
  • Layer 13: earring right

Folder 5: FACE

  • Layer 14: round face
  • Layer 15:  square face

 

I want to be able to feed it specific instructions on which single layers to use, e.g.:

 

Export PNG 1 = Folder1:layer3 + Folder2:layer5 + Folder3:layer8 + Folder5:layer14

This will export a "round face" with "aviator" glasses, "medium" hair, "closed" mouth, and NO jewelry (since no layers from Folder 4 were specified).

 

In the script - i will instruct the specific ~1,000+ combinations I'm looking for (e.g. 1,000+ final PNGs).

 

The canvas is only 24x24 pixels - so the file (and the layers) is quite small.

 

I was able to get the PhotoshopCompositionComposer script to work - but the way it works, is it produces every possible combination across the Folders - in my case, it was going to create 89K PNGs - which was going to take my laptop 3+ days of processing (based on the time it took to make ~20 before I shut it down).  I'd rather just have a script with the specific 1,000 combos defined - using the processing power only to produce those combos.  Does this better explain it?  Thanks in advance!