• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Adobe Photoshop Bounds of a layer?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adobe Photoshop Bounds of a layer?


  • Subject: Re: Adobe Photoshop Bounds of a layer?
  • From: Shane Stanley <email@hidden>
  • Date: Fri, 05 Sep 2014 09:21:03 +1000

On 5 Sep 2014, at 4:27 am, Dave <email@hidden> wrote:

I have a PSD that is 40,40 Pixels 

I then have 4 Fill Rects at, X,Y with a Width, Height of 20,20

Rect1: X,Y: 0,0 
Rect2: X,Y 20,0
Rect3: X,Y 0,20
Rect4: X,Y 20,20

Now when I read bounds in my Script I get everything offset by -1 or sometimes -2. From experimenting with other PSD this negative offset various.

Why is this? 

Something in your code, I suspect.

It’s to do with the way in which layers “float” until they are flattened. So, a whole PSD  have it’s original set somewhere in a infinite space, but the extent, width and height are constant.

Um, no, that's not so.

I made up a document as you describe and ran this:

tell application id "com.adobe.Photoshop" -- Adobe Photoshop CC 2014.app
set theBounds to bounds of art layers of document 1
end tell
log theBounds --> {{20.0, 20.0, 40.0, 40.0}, {0.0, 20.0, 20.0, 40.0}, {20.0, 0.0, 40.0, 20.0}, {0.0, 0.0, 20.0, 20.0}, {0.0, 0.0, 40.0, 40.0}}
repeat with i from 1 to count of theBounds
set item i of theBounds to my cocoafy(get item i of theBounds)
end repeat
return theBounds --> {{20.0, 20.0, 20.0, 20.0}, {0.0, 20.0, 20.0, 20.0}, {20.0, 0.0, 20.0, 20.0}, {0.0, 0.0, 20.0, 20.0}, {0.0, 0.0, 40.0, 40.0}}

on cocoafy({x1, y1, x2, y2})
return {x1, y1, x2 - x1, y2 - y1}
end cocoafy

Unless PS is doing something different in _javascript_, that looks pretty straight-froward, with no sign of errant 1s.

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Adobe Photoshop Bounds of a layer?
      • From: Dave <email@hidden>
References: 
 >Adobe Photoshop Bounds of a layer? (From: Dave <email@hidden>)
 >Re: Adobe Photoshop Bounds of a layer? (From: Martin Orpen <email@hidden>)
 >Re: Adobe Photoshop Bounds of a layer? (From: Dave <email@hidden>)
 >Re: Adobe Photoshop Bounds of a layer? (From: Alex Zavatone <email@hidden>)
 >Re: Adobe Photoshop Bounds of a layer? (From: Dave <email@hidden>)

  • Prev by Date: Re: Adobe Photoshop Bounds of a layer?
  • Next by Date: Re: Adobe Photoshop Bounds of a layer?
  • Previous by thread: Re: Adobe Photoshop Bounds of a layer?
  • Next by thread: Re: Adobe Photoshop Bounds of a layer?
  • Index(es):
    • Date
    • Thread