Page 1 of 1
Split text by paragraphs / white line
Posted: 2017-06-03T16:19:58-07:00
by tecya
Hi, I wanted to split
http://i.imgur.com/CWkj5dv.jpg into
http://i.imgur.com/vFAFtqh.jpg.
I used the divide_vert script, however it splitted too much.
Reading the TO_DO list in the code I found that the minimun height is planned for a future version.
Can somebody help me?
Maybe the number could somehow be used as a separator?
Thanks
I'm using the latest version of IM. OS are Ubuntu and OS X.
Re: Split text by paragraphs / white line
Posted: 2017-06-03T17:53:56-07:00
by snibgo
tecya wrote:I'm using the latest version of IM.
Latest version of v6 or v7? Please say exactly which version.
What divide_vert script? Perhaps the one at
http://www.imagemagick.org/Usage/scripts/divide_vert
The required results are obtained from:
Code: Select all
set guilMIN_GAP=20
call %PICTBAT%guillotine CWkj5dv.jpg chop_XX.png White 5 . 1
The script is on my page
Subimage rectangles. It is Windows BAT, for IM v6, but fairly easily translated to bash and/or IM v7.
Re: Split text by paragraphs / white line
Posted: 2017-06-04T06:21:49-07:00
by tecya
Thanks, sadly It didn't work. I also spent 5 hours trying to customize the divide_vert script, but without success
Re: Split text by paragraphs / white line
Posted: 2017-06-04T11:44:01-07:00
by fmw42
This may be similar to what snibgo suggested. But consider blurring the text, then thresholding, average down to 1 column and then expand back to full size for viewing, then threshold again. This produces a black and white image. The white lines separate your paragraphs. You can then crop to 1 column and send that to txt: format as a list. Then find the locations of the centers of each white area. Then you can draw gray lines at those locations in your original image. Or you can crop your image at each black area to separate each paragraph as its own image and combine as you desire with gray around it.
Code: Select all
convert CWkj5dv.jpg -blur 13x65000 -auto-level -threshold 90% -scale 1x1754! -scale 1240x1754! -auto-level -threshold 90% CWkj5dv_bw.png