I want to make a Photoshop script that lets me export all five layers in a group to a png file
– in combination with every single layer from 2 other groups.
It’s a bit vague so I’ll try to illustrate what I want to
accomplish. There’s the base group (red, blue, yellow, orange,
green). Then there is a second group that contains layers 1,2 and 3.
Then there’s a third group that contains a, b, c and d.I want to
be able to export 1_red_a.png, 1_red_b.png, 1_red_c.png, 1_red_d.png,
1_blue_a.png, 1_blue_b.png, …
I don’t have much experience with Photoshop scripts. Is this something that can be accomplished? And if so, is anyone prepared to help me?
2
Answers
I think I have got the idea of what you want. I find ExtendScript pretty awkward to code in and would tend to do automated stuff outside of Photoshop with more powerful, everyday tools. I would go with ImageMagick and
bash
. ImageMagick is free and available for Windows, and the basic command to composite two images on top of one another isOf course you can change any or all of the
PNG
suffices toTIF
,JPG
or whatever you like.So, for your question, I have made a sample file with a couple of Groups to show the concept, like this:
The Photoshop file is avilable here.
Zoom into the
Layers
palette (on the right in the above image) to see the 2 groups I made.Then go to File->Scripts->Export Layers to Files, and select the options like this:
That will export the following files for you:
Note that the format is
xxx<GROUP>s_xxx<LAYER>xxx.png
Now you can easily create all permutations of the groups with this
bash
script. I presume the Windows BATCH file would be pretty similar – though I only do Windows under duress !!!which gives you these output files:
Just for kicks, I put them all together in a montage and you get this:
Note that if you have 3 groups, you will need a third inner loop in your script, and the command to composite the 3 images together will be more like this (because the
-composite
option takes the two preceding images):Alternatively, you may find you can use
Photoshop Composition Composer will create compositions of whatever is contained in the top-level
groups
. The the name of agroup
and thelayer
belonging to it joined together will be your file name.Usage
photoshopCompositionComposer
jsx
-fileFile > Scripts > Browse...
jsx
fileExample
Layers
Group
animals.Layer
dog_Group
cat_Group
background.Layer
sea_Group
space_Layer
underWater_Resulting Compositions
Preview