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

Detect transparent pixels

Engaged ,
Jan 06, 2021 Jan 06, 2021

Copy link to clipboard

Copied

I'm trying to discover a way of detecting transparent pixels. More over if an image is on a transparent background. Looking at the four corner pixels will be sufficient.

 

Only I don't think there's a way to detect RGBA as if the code below is run on a transparent pixels it throws an General Photoshop 8800 error. Any ideas? Apart from a try/catch and or trying to copy paste said pixels.

 

  // Add a Color Sampler at a given x and y coordinate in the image.
  var pointSample = app.activeDocument.colorSamplers.add([(x),(y)]);

  // Obtain array of RGB values.
  var rgb = [
  pointSample.color.rgb.red,
  pointSample.color.rgb.green,
  pointSample.color.rgb.blue
 ];

 

TOPICS
Actions and scripting , Windows

Views

128

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
no replies

Have something to add?

Join the conversation
Adobe