Page 1 of 2

Changing the leading space in image

Posted: 2016-01-17T19:03:28-07:00
by user20157
Is there anyway i can change the leading space of text lines in images so that it appears larger?

Re: Changing the leading space in image

Posted: 2016-01-17T19:19:42-07:00
by snibgo
If you mean in...

Code: Select all

label:"Hello world"
... etc, then just put in a leading space or two, and perhaps also trailing spaces:

Code: Select all

label:" Hello world "

Re: Changing the leading space in image

Posted: 2016-01-17T19:32:28-07:00
by user20157
i mean line-spacing in actual images:
"aaaa
bbbbb"
i would like it to be changed to :
"aaaa

bbbb
"
Something like that

Re: Changing the leading space in image

Posted: 2016-01-17T20:46:47-07:00
by fmw42

Re: Changing the leading space in image

Posted: 2016-01-17T21:06:56-07:00
by user20157
But that only works on raw text input into command line. How can i make it work with existing image ?

Re: Changing the leading space in image

Posted: 2016-01-17T22:00:31-07:00
by fmw42
user20157 wrote:But that only works on raw text input into command line. How can i make it work with existing image ?
I am not sure what you mean by existing images?

Once you have raster data you would have to do OCR to get the text again and then regenerate the image with a different interline-spacing.

Or you would have to crop out each row of text and then composite it back onto a white background with different offsets (-geometry), so that there is more space between lines of text.

If I misunderstand, please clarify further.

Re: Changing the leading space in image

Posted: 2016-01-17T23:22:27-07:00
by user20157
My problem is that OCR like Tesseract doesn't extract text from the images as accurately as i expected. Thats why i want to try to increase the line spacing so that i can see any improvement or not.

Re: Changing the leading space in image

Posted: 2016-01-17T23:34:39-07:00
by fmw42
Perahps you should upload an example of your image to some place such as dropbox.com and put the URL here, so we can see your image and perhaps offer appropriate suggestions.

Always best to provide your IM version and platform when asking questions, since syntax may differ.

See viewtopic.php?f=1&t=9620

Re: Changing the leading space in image

Posted: 2016-01-17T23:50:21-07:00
by user20157
My original image is : http://imgur.com/NralART
I want something look like this :http://imgur.com/xKoKlS
My IM version: 6.9.3-0 Q16 x64
Platform:Windows 10 command line
Thank you very much,

Re: Changing the leading space in image

Posted: 2016-01-18T00:39:57-07:00
by fmw42
Invalid link for http://imgur.com/xKoKlS

Did we not go into a similar issue with you at viewtopic.php?f=1&t=28967.

I do not think changing the spacing between lines will do much good.

The only way I know to do that, is to separate out each line and recomposite together. To separate out each line, you can average the image into 1 column and look for white spaces. They are the coordinates that separate the black text. Crop each row at those spacings and recomposite them back with more space between them.

Re: Changing the leading space in image

Posted: 2016-01-18T01:09:30-07:00
by user20157
Could you please elaborate more on sentence "average the image into 1 column" ?

Re: Changing the leading space in image

Posted: 2016-01-18T01:33:09-07:00
by user20157
My second link image is : http://imgur.com/eBn6lKv

Re: Changing the leading space in image

Posted: 2016-01-18T10:26:22-07:00
by fmw42
With accent marks above and below text characters, my concept of averaging to one column is not going to work. But if you want to try

Code: Select all

convert image -resize 1x! txt:
The txt: will list the column pixel values to the terminal or you can write them to a string or to a text file for further analysis.

Re: Changing the leading space in image

Posted: 2016-01-18T18:21:10-07:00
by user20157

Code: Select all

0,0: (64533,64505,64505,65535)  #FBFBFBFF  srgba(251,251,251,1)
On the code above, i understand #FBFBFBFF srgba(251,251,251,1) represent rgb red, blue and yelllow and alpha values in integer and hexadecimal numbers. What do (0,0) and (64533,64505,64505,65535) represent?

Re: Changing the leading space in image

Posted: 2016-01-18T18:56:49-07:00
by fmw42
The values are red, green, blue and alpha (not yellow). The 0,0 is the x,y coordinate for that pixel's color. You should be getting a whole column of values not just for 0,0. The r,g,b,a values in parens are "raw" values in your IM compile. If Q16 then 0 to 65535, if Q8 then 0 to 255.