Skip to main content
Inspiring
April 4, 2022
Answered

Scripting. get the number of pixels in the alpha channel of an image layer ?

  • April 4, 2022
  • 4 replies
  • 885 views

Hi guys.

Someone tell me how I can get the number of pixels in the alpha channel of an image layer ?

This topic has been closed for replies.
Correct answer r-bin

Algorithm (the hint).

Turn the transparency channel into a selection (ctrl+click on layer )

Save it to new alpha channel.

Select only this alpha channel.

Read the document's histogram value at index 255.

 

4 replies

r-binCorrect answer
Legend
April 4, 2022

Algorithm (the hint).

Turn the transparency channel into a selection (ctrl+click on layer )

Save it to new alpha channel.

Select only this alpha channel.

Read the document's histogram value at index 255.

 

AnyONAuthor
Inspiring
April 4, 2022

Thank you, r-bin...

Kukurykus
Legend
April 4, 2022

That seems to be solution - mark it as correct answer if you think so 😉

Kukurykus
Legend
April 4, 2022

While you're back to forum, was the answer given in Photoshop Scripting. How to put each closed path on a separate Path layer ? that you were looking for?

AnyONAuthor
Inspiring
April 4, 2022

Yes, I already use this knowledge.

Kukurykus
Legend
April 5, 2022
AnyONAuthor
Inspiring
April 4, 2022

Someone tell me how can I get the number of pixels in the alpha channel of an image layer whose transparency value is 0.

Sorry///

Stephen Marsh
Community Expert
Community Expert
April 4, 2022

More information is required, ideally you can attach samples. Black, white or shades of grey?

 

I think that I recall a script for how many pixels in an irregular selection and one can load an alpha as selection...