Skip to main content
Participant
March 9, 2021
Question

How to Automate Selection of Black Bands

  • March 9, 2021
  • 2 replies
  • 899 views

I need to batch process images that are flanked by black areas. These black areas may be top and bottom, or left and right. They vary in proportion, but regardless I need to delete these black areas without selecting any black within the central image. Shown here are two images that typical of what I am starting with. The idea is to crop down to just the central image and eliminate the black boundary, without selecting incidental black in the central image.

 

What is the best sequence of actions to accomplish this? Thank you!

 

.

This topic has been closed for replies.

2 replies

Bojan Živković11378569
Community Expert
Community Expert
March 9, 2021

I just tested and it works to record single step action then to batch process. The only requirement is that you must have always black color in top left or bottom right corner, in other words all your images must be either as example 1 or as example 2.

 

Update: based on @r-bin suggestion which seems to work to avoid tiny black border, record additional step with black point set to 20 in Levels adjustment layer as shown on screenshot below, it does work for tested single image, test with random chosen image or try to find consistency like single pixel black border then record step to delete that border, you can use conditional actions to check orientation of image.

 

After recording single step action run File > Scripts > Image Processor and check Run Action then choose proper set and action in section 4.

Legend
March 9, 2021

Try to insert a Levels layer with parameters 128-1-255 -> 0-255. Execute the Trim command for Top Left Pixel Color. Then delete the Levels layer.

Kukurykus
Legend
March 9, 2021

Wouldn't be result the same after trimming without using adjustment layer?

Legend
March 9, 2021

Wouldn't.

There's noise on black