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!
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.
Wouldn't be result the same after trimming without using adjustment layer?
There's noise on black
Oh okay, I assumed bands are 100% black, but maybe while posting they lost their uniformity.
I understand what you're saying, but would this also cut any black pixels from the central img, too?
Have you tried it yourself?
If at any border of the "useful picture" there is at least a pixel with a level greater than 128, then the "Trim" will not go deeper into the image further than this pixel. You can change the value of 128 (the first parameter for Levels), for example, by setting the value 20.
For your first image, 11 is enough, for the second 13. Otherwise, there will be remnants of "black".
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.
single step action run File > Scripts > Image Processor and check Run Action then choose proper set and action in section 4.