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

need to check if active layer has transparent/inactive pixels? / boolean. Thanks!

Explorer ,
Apr 06, 2015 Apr 06, 2015

Copy link to clipboard

Copied

is there a check that i can do that will return whether or not the active layer has transparent pixels? thanks a trillion!

TOPICS
Actions and scripting

Views

959

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
Explorer ,
Apr 06, 2015 Apr 06, 2015

Copy link to clipboard

Copied

Alright everyone calm down, i know everyone was in the middle of writing an answer but i found something that while is not precisely what i intended, gets the job done for what i needed.

the =

isBackgroundLayer


property of an artlayer. which pretty much tells me whether or not the ducoument is flattened. I know that i can check whether or not individual pixels have transparency but that would make the entire script a lot more complicated than what i actually need.

By the way, EVERYONE Gets to keep their million 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
Enthusiast ,
Apr 06, 2015 Apr 06, 2015

Copy link to clipboard

Copied

Just want to point out that a background layer is format specific. I.e. if you create a doc with transparent background, it does not have a background. And flattening a doc without background does not create one. Also in case you need to check per-layer, see function below

isAreaEmpty: function (left, top, right, bottom) {

  var selection_area = new Array(new Array(left, top), new Array(right, top), new Array(right, bottom), new Array(left, bottom))

  var selection = app.activeDocument.selection

  selection.select(selection_area)

  try {

  selection.copy()

  } catch (e) {

  return true

  } finally {

  selection.deselect()

  }

  return false

},

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
Community Expert ,
Apr 07, 2015 Apr 07, 2015

Copy link to clipboard

Copied

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
Community Expert ,
Apr 07, 2015 Apr 07, 2015

Copy link to clipboard

Copied

LATEST

Another option might be to select the transparency, then check the Selection’s histogram.

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