• 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: Dave <email@hidden>
  • Date: Fri, 05 Sep 2014 09:55:43 +0100

Hi,

I’m using PS CS6.

On 5 Sep 2014, at 00:21, Shane Stanley <email@hidden> wrote:

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 not just my code, It shows this in standard scripts too. I’m not saying you can’t create a PSD that has everything 0,0 based it’s just you can also create one with negative X,Y.

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.

Well, you got lucky or you version of PS is different. I’m seeing -1’s, -2’s etc and one case where everything seemed to be based around 31! 

Here is a dump of the bounds:

PhotoShop - Rect: [19 px,-1 px,41 px,21 px]
PhotoShop - Rect: [19 px,-1 px,41 px,21 px]
PhotoShop - Rect: [-1 px,19 px,21 px,41 px]
PhotoShop - Rect: [19 px,19 px,41 px,41 px]

So, it’s definitely returning the rects shifted.

All the Best
Dave















 _______________________________________________
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: Shane Stanley <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>)
 >Re: Adobe Photoshop Bounds of a layer? (From: Shane Stanley <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