I need to cut them horizontally, into n pieces.
Example:

Output:



The following image shows the pixel rows that contains ONLY white color (highlighted by yellow). This maybe could help.

Recap
Preconditions:
- the background of input image is always white #ffffff (it never changes - ie. i am not scanning text from a book).
- text lines never overlaps (there is a clear separation between text lines)
Postconditions (let's be n = #text lines) :
- it should produces n images per n lines
- the result images should be trimmed (it's easy using -trim option)
Thanks for help
