I have this sample image:
![Image](http://masejoer.com/Images/IM/image_step9.jpg)
I want to keep only the digits in the center of the image. Is there a way in IM, without writing things out to file, to remove the black bars at the top and bottom of the image? If I take the average grayscale value of each row, if fewer then X number of rows have a dark color, convert them to white. In other words, if a contiguous number of rows less than 30-pixels high have a darker average color, make the white. If there are more than 30 contiguous rows that have a darker average color, leave them intact.
Here is the output I'm going for:
![Image](http://masejoer.com/Images/IM/image_step9_desired.jpg)
I know I can, as someone recommended in another thread for a different question I had, resize down to 1 column wide to get average grayscale values, and then use those values in a script to perform the logic externally, but processing that way was very slow due to only processing one line at a time with IM.
Tips or ideas? Thanks!
I'm running ImageMagick-7.0.1-6 Q16-x64 on Windows (.bat) and 7.0.2-5 Q16-x64 on Ubuntu (.sh).