I have a .psd file with around 8 layers. But first, for simplicity, let's suppose a file with 4 layers:
Layer 0
Layer 1
Layer 2
Layer 3
This would give us 2^4 possible combinations, which is 16 images as output as follow:
None visible
Only 0 is visible
Only 1 is visible
Only 2 is visible
Only 3 is visible
0 and 1 are visible
0 and 2 are visible
0 and 3
1 and 2
1 and 3
2 and 3
0, 1, 2
0 1 3
0 2 3
1 2 3
All are visible
I could do this by hand but for 2^8 images, this would take a lot of time, and would be confusing like "Hmm, did I do this combination already?". Because for each combination, I'd need to export each image as an image file (preferably png), which would take a lot of time.
So, is there a way to programmatically achieve this? Maybe a script that could read the PSD file for layers and hide them or make the layers visible in a very large for loop where it will export as PNG for each combination.
And for generating the combination, I was thinking of binary, so for example, the 4 layers could be
0000
0001
0010
0011
...etc.
where each bit represents a layer, and this would be much faster for the 8 layers.
Yes, it's possible with Photoshop script. There are a couple of things you'll have to work out, but the main loop is basically this:
Note that switching layers off and on with a large number of layers in a Photoshop document is notoriously slow. Hopefully 16 layers won't be too painful.