How to batch trim a white/gray legend from the bottom of image?
Posted: 2015-08-30T16:47:12-07:00
I have several hundred images of varying sizes and orientations. I need to trim them for a project.
Each has a short (~30px) white border across the bottom which contains the filename in gray text. The height of the border varies by a few pixels between images.
I'd like to trim this bottom border off. I did a quick 'n' dirty -chop just to get going on the project but I'm losing between 1-5 pixels from some images.
Is there a way to detect the white area at the bottom, given that it contains gray text also?
Can I scan down the lines until I find a solid white line then chop from there?
Reference image:
Each has a short (~30px) white border across the bottom which contains the filename in gray text. The height of the border varies by a few pixels between images.
I'd like to trim this bottom border off. I did a quick 'n' dirty -chop just to get going on the project but I'm losing between 1-5 pixels from some images.
Code: Select all
mogrify -gravity South -chop 0x30 *.jpg
Can I scan down the lines until I find a solid white line then chop from there?
Reference image: