Changing the leading space in image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
user20157
Posts: 19
Joined: 2016-01-11T18:17:14-07:00
Authentication code: 1151

Changing the leading space in image

Post by user20157 »

Is there anyway i can change the leading space of text lines in images so that it appears larger?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Changing the leading space in image

Post 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 "
snibgo's IM pages: im.snibgo.com
user20157
Posts: 19
Joined: 2016-01-11T18:17:14-07:00
Authentication code: 1151

Re: Changing the leading space in image

Post by user20157 »

i mean line-spacing in actual images:
"aaaa
bbbbb"
i would like it to be changed to :
"aaaa

bbbb
"
Something like that
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Changing the leading space in image

Post by fmw42 »

user20157
Posts: 19
Joined: 2016-01-11T18:17:14-07:00
Authentication code: 1151

Re: Changing the leading space in image

Post by user20157 »

But that only works on raw text input into command line. How can i make it work with existing image ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Changing the leading space in image

Post 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.
user20157
Posts: 19
Joined: 2016-01-11T18:17:14-07:00
Authentication code: 1151

Re: Changing the leading space in image

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Changing the leading space in image

Post 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
user20157
Posts: 19
Joined: 2016-01-11T18:17:14-07:00
Authentication code: 1151

Re: Changing the leading space in image

Post 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,
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Changing the leading space in image

Post 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.
user20157
Posts: 19
Joined: 2016-01-11T18:17:14-07:00
Authentication code: 1151

Re: Changing the leading space in image

Post by user20157 »

Could you please elaborate more on sentence "average the image into 1 column" ?
user20157
Posts: 19
Joined: 2016-01-11T18:17:14-07:00
Authentication code: 1151

Re: Changing the leading space in image

Post by user20157 »

My second link image is : http://imgur.com/eBn6lKv
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Changing the leading space in image

Post 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.
user20157
Posts: 19
Joined: 2016-01-11T18:17:14-07:00
Authentication code: 1151

Re: Changing the leading space in image

Post 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?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Changing the leading space in image

Post 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.
Post Reply