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

Selection of All White Pixel Clusters >1x800 and Fill in New Channel

Explorer ,
Aug 05, 2024 Aug 05, 2024

I have a TIFF file with dimensions 18320x24440 pixels and a resolution of 508 ppi. The image consists only of black and white pixels, with no gray tones. I would like to create a script that does the following:

  1. Select all the white areas with a width or height greater than 1x800 pixels.
  2. Combine these areas into one selection.
  3. Fill a layer or channel within this selection with black.

Can someone help me with this?

TOPICS
Actions and scripting , macOS
3.5K
Translate
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

correct answers 1 Correct answer

Engaged , Aug 08, 2024 Aug 08, 2024

Hi, 

Save the following in a .psjs file and File > Scripts > Browse...

It should output a selection of the clusters you need. Caveat: it doesn't work on Bitmap, please convert the image to Grayscale first.

 

const photoshop = require("photoshop");
const { core, imaging, app } = photoshop;

async function getDocumentPixelData(documentID) {
  const document = app.activeDocument;
  const width = document.width;
  const height = document.height;

  try {
    // Get the pixel data of the document
    con
...
Translate
Adobe
Explorer ,
Aug 08, 2024 Aug 08, 2024

@Davide_Barranca Can I ask you if you build in some extras in this script? 

 

Translate
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
Explorer ,
Aug 08, 2024 Aug 08, 2024
LATEST

It would be very helpfull if the script starts with dialog screen where it horizontal or vertical, black or white, amount of min or amount of max pixels. It`'s only possible to have one answer per question. Something like attached Screenshot 2024-08-08 at 17.14.47.pngexpand image

Translate
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