Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong layer size in script #6740

Closed
jxw1102 opened this issue May 10, 2024 · 1 comment
Closed

Wrong layer size in script #6740

jxw1102 opened this issue May 10, 2024 · 1 comment

Comments

@jxw1102
Copy link

jxw1102 commented May 10, 2024

Your Operating System: macOS 14.4.1 (23E224)
Your Web Browser: Chrome 124.0.6367.79 (Official Build) (arm64)

This must be done to see the problem

  1. Go to www.photopea.com
  2. Open 2 psd files: for example, fileA and fileB
  3. Copy pixels of fileA: ⌘+A then ⌘+C
  4. Paste in fileB
  5. Execute the following script
var layer = app.activeDocument.activeLayer;
alert(layer.bounds[2].value + 'x' + layer.bounds[3].value)

We can observe in the screenshot that, the size returned by script (757x997) is not the same as the size in Layer Properties (216x233).

Screenshot 2024-05-11 at 00 59 32

Please make a fix. Many Thanks.

@jxw1102 jxw1102 changed the title Cannot get the correct size of pasted layer in script Wrong layer size in script May 10, 2024
@photopea
Copy link
Owner

This it how it should work. Layer.boudns does not contain the width and the height of a layer. They are the coordinates of the top left and the bottom right corner of a layer. Please see the documentation from the Adobe company to learn what each layer property means.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants