Photoshop scripts: move image to x, y

I have an active ArtLayer referenced by the NewLayer variable, which I want to move to the absolute x, y position on the canvas.

I’m going to work on the Internet for a couple of hours without any results. Can someone give an example?

//Thanks.

+6
source share
1 answer

After a few more reading and searching the API, I came to the conclusion that you can only move a layer with delta movement.

I wrote this little function to position the layer in absolute position. Hope this is helpful to the next reader with the same question ...

 //****************************************** // MOVE LAYER TO // Author: Max Kielland // // Moves layer fLayer to the absolute // position fX,fY. The unit of fX and fY are // the same as the ruler setting. function MoveLayerTo(fLayer,fX,fY) { var Position = fLayer.bounds; Position[0] = fX - Position[0]; Position[1] = fY - Position[1]; fLayer.translate(-Position[0],-Position[1]); } 
+14
source

Source: https://habr.com/ru/post/923434/


All Articles