automate batch layer composition & export

Explorer ,
Jun 20, 2021 Jun 20, 2021

Copy link to clipboard

Copied

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.

TOPICS
Actions and scripting

Views

1.3K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 20, 2021 Jun 20, 2021

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 20, 2021 Jun 20, 2021

Copy link to clipboard

Copied

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!

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jun 20, 2021 Jun 20, 2021

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 20, 2021 Jun 20, 2021

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

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. 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

Playing with this Dataset feature - thanks.  Seems to be what I need.  Wish there were a way to "export" the CSV file of all the "variables" - so I can create my CSV offline and "import" it.  I have 100+ variables, so it's time-consuming to recreate that in XLS as a first step.  Is there an easy "export variable list" feature somewhere?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

No built in functionality. You can accept default naming convention and perhaps automate data creation in excel.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 21, 2021 Jun 21, 2021

Copy link to clipboard

Copied

Yeah - I had to re-write the 100+ variable names in XLS to build the import file - was a pain, and made many errors before the import worked.

 

This solution seems to work so far - it's worked with an import of a batch of ~100 data sets.  True test is next - whether it can accept a batch of ~2K data sets 🙂

 

Thanks Bojan for your support!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

I am not aware of any limitation, especially to show/hide layers in the file. Good luck, I tried several times to import and scale 50+ images for several exported files and it worked. Your task is easier and it should work with 2000 instructions (I think you are reffering 20 data sets x 100 variables). One data set is actually one line of data, in your case that will be 100 true or false.  

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 22, 2021 Jun 22, 2021

Copy link to clipboard

Copied

LATEST

2000 data sets (100 instructions in each dataset).

It worked with 88 data sets (100 instructions) - still building my full universe of data sets so I haven't tested yet.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines