Move layer to certain position in PhotoShop

Hi everyone,

I’m trying to move a layer to a specific position in my image. I tried

translate layer 1 delta x 100

But that moves my layer 100 pixels… I’d want it to be in a specific position in the current document.

Is this possible? (I also tried doing it with a PhotoShop action but that didn’t work out great)

Thanks

Where is this specific position? The norm I think would be to use document height/width and layer bounds and calculate your delta x & y values.

Thanks Mark :slight_smile:

Well, my image is a square of 500 px and the width of the pasted layer is also 500px but only 300px in height. I want it to be positioned on 150 px from the top and thus 50 px from the bottom. I know how to get the dimensions of the documents but I already know them before using the script so that’s not a problem. I tried

set theBounds to bounds of layer "Layer 1"

and it gave me the bounds in centimeters, I’d like to have them in pixels but this gave an error

set theBounds to bounds of layer "Layer 1" as pixels

Any advice?

If this is the case is your pasted layer NOT centered? 500 pixels - 300 pixels = it is already 100 pixels down from top left just translate a further 50 pixels. Or have I overlooked some thing?

As a rule I always set the app settings to pixel units do script stuff then put the settings back.

Hmm, it’s kind of weird, my script uses a layer from another image and duplicates it in a new document like this:

tell the current document
	duplicate layer 1 to beginning of document "doc.psd" of application "Adobe Photoshop CS4"
end tell

And if the layer is transparent, it looks like it duplicates it on the top of the other document but if it isn’t, it indeed centers it. The ruler settings thing works great :slight_smile: