I am a newbie in PS. Currently I am using Adobe PS CC, in which I want to merge quite a number of images together to form a "collage". Those images are already named with coordinates, like (0, 1).png with size 1280 x 1280 pixel, and I already load all of them into a PS document by photomerge. I suppose each of them is contained in a independent layer, and I can use free transform to move those layers to my required position such that those images can resemble into a large image like a puzzle. When the number of layers is large, doing this by hand is really a tedious work. So I want to automate it with the script. I have try the following script and run it, but without any response; please correct me as I am new (and also new in JavaScript as well)
# target photoshop function Main() { MoveLayerTo = function(l, x, y) { var b = l.bounds; var x1 = b[0].as("px"); var y1 = b[1].as("px"); var x2 = b[2].as("px"); var y2 = b[3].as("px"); var xc = x1 + (x2-x1)/2; var yc = y1 + (y2-y1)/2; l.translate(x-xc, y-yc); }; var i = 0; var j = 0; for (i = -6; i < 3; i++) { for (j = 3; j > -11; j--) { MoveLayerTo(app.activeDocument.layers.getByName("(" + i + ", " + j + ").png"), new UnitValue(640 + (i + 6) * 1280, "px"), new UnitValue(640 + (3 - j) * 1280, "px")) } } }