imagemagick - Photoshop script to export layer combinations -
i want make photoshop script lets me export 5 layers in group png file - in combination every single layer 2 other groups.
it's bit vague i'll try illustrate want accomplish. there's base group (red, blue, yellow, orange, green). there second group contains layers 1,2 , 3. there's third group contains a, b, c , d.
i want able 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 experience photoshop scripts. can accomplished? , if so, prepared me?
i think have got idea of want. find extendscript pretty awkward code in , tend automated stuff outside of photoshop more powerful, everyday tools. go imagemagick , bash. imagemagick free , available windows, , basic command composite 2 images on top of 1 is
convert image1.png image2.png -composite result.png of course can change or of png suffices tif, jpg or whatever like.
so, question, have made sample file couple of groups show concept, this:

the photoshop file avilable here.
zoom layers palette (on right in above image) see 2 groups made.
then go file->scripts->export layers files, , select options this:

that export following files you:
layers_0000s_0002_layer a.png layers_0000s_0001_layer b.png layers_0000s_0000_layer c.png layers_0001s_0003_layer 1 - red.png layers_0001s_0002_layer 2 - green.png layers_0001s_0001_layer 3 - blue.png layers_0001s_0000_layer 4 - magenta.png note format xxx<group>s_xxx<layer>xxx.png
now can create permutations of groups bash script. presume windows batch file pretty similar - though windows under duress !!!
#!/bin/bash i=0 # iterate on group 0 files in *0s_*.png; j=0 # iterate on group 1 files b in *1s_*.png; convert "$a" "$b" -composite out_${i}_${j}.png ((j++)) done ((i++)) done which gives these output files:
out_0_0.png out_0_1.png out_0_2.png out_0_3.png out_1_0.png out_1_1.png out_1_2.png out_1_3.png out_2_0.png out_2_1.png out_2_2.png out_2_3.png just kicks, put them in montage , this:

note if have 3 groups, need third inner loop in script, , command composite 3 images more (because -composite option takes 2 preceding images):
convert image1.png image2.png -composite image3.png -composite result.png alternatively, may find can use
convert -background none image1.png image2.png image3.png -flatten result.png
Comments
Post a Comment