• 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 11:32:23 +0100

Hi,

It’s the same without the ViewConfig in the file, this is created AFTER the process is run. Delete it and try again!

My Script code does the same as yours and it’s picking up the right layers. When processing Art Layers, it ignores anything that begins with a “-“ and also my loop is confined to the art layers into -pShapeX groups.

I’ve run this file with a simple X,Y dumper I got from the web and it shows negative offsets (without any extra groups or layers being added to the PSD, just the 4 shapes).

All the Best
Dave

On 5 Sep 2014, at 10:47, Shane Stanley <email@hidden> wrote:

On 5 Sep 2014, at 6:55 pm, Dave <email@hidden> wrote:

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! 

No, I get the same with CS6. 

(Dave sent me the document off-list.)

The problem is that you failed to mention that there are several other layers in that document, and it looks like you're getting the bounds of the wrong ones (the ones in the ViewConfig layer set).

If I change my code to allow for the fact that you have all layers enclosed in layer sets:

tell application id "com.adobe.Photoshop" 
set theBounds to bounds of art layers of layers of document 1
set x to art layers of layers of document 1
end tell
log theBounds 
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 

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

I get:

{{0.0, 0.0, 20.0, 20.0}, {20.0, 0.0, 20.0, 20.0}, {0.0, 20.0, 20.0, 20.0}, {20.0, 20.0, 20.0, 20.0}, {4.0, -5.0, 299.0, 58.0}, {4.0, -5.0, 299.0, 58.0}, {4.0, -5.0, 299.0, 58.0}, {4.0, -5.0, 299.0, 58.0}, {4.0, -5.0, 365.0, 118.0}, {0.0, 0.0, 40.0, 40.0}}

The first four are the squares; the rest are other art layers in your document.

-- 
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: 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>)
 >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