• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Getting bounds error.

Participant ,
Oct 16, 2013 Oct 16, 2013

Copy link to clipboard

Copied

Hi All,

I am writing a script to get the height and width of the layer.

I am getting the bounds of the layer and calculate the width and height.

Now when I try to get the bounds of layer with effect applied on that layer. I am getting incorrect bounds.

Is this a bug in photoshop or am I missing something?

Is there any appropriate solution for calculating the bounds of layer if effect is applied on that layer.

Effect could be stroke, drop shadow, inner shadow etc.

Thanks..

TOPICS
Actions and scripting

Views

670

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Guru ,
Oct 16, 2013 Oct 16, 2013

Copy link to clipboard

Copied

I don't know if it is a bug or not but it has been that way until Photoshop CC. Really it still is that way, CC added a new property to artLayer that will let you get the bounds without effects.

app.activeDocument.activeLayer.boundsNoEffects

If you don't have CC you need to turn off the layer effects before getting the bounds. Note not all layer effects change the bounds but it is easier just to turn the effects off as a group.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 16, 2013 Oct 16, 2013

Copy link to clipboard

Copied

Thanks for the reply Michael,

But I need to get the bounds with effects on it.

Let's say we apply stroke to an object. Now the height and width of that layer changed.

I need to get the correct bounds of that layer with stroke applied on it..

Is there any solution for this?

Thanks.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Oct 17, 2013 Oct 17, 2013

Copy link to clipboard

Copied

LATEST

What version of Photoshop are you using? In every version I remember the bounds included layer effects if the effect changes bounds. For example a 3px inter stroke effect would not change the bounds but that same size storke set to center or outer would change the bounds.

So you should not need to do any extra steps to get the bounds that include the effects. app.activeDocument.activeLayer.bounds will give you the bounds with the effects applied.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines