ImageMagick - multiline text gap

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
hdagheda

ImageMagick - multiline text gap

Post by hdagheda »

hi, i am try to reduce the gap between 2 lines in imagemagick.

i generated image with specifying font but the generated image has too much gap between lines. does any one know how to solve this problem?

i read somewhere that – line gap depends on which fond you use but i want to minimize that.

this is my command:

convert ".$path.$large." -gravity center -pointsize 25 -font /usr/share/fonts/winfonts/ARIAL.TTF -fill '#555555' -style Normal -weight Normal -annotate +0+50 \"$msg\" ".$path.$large;

Thanks.
Heena
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ImageMagick - multiline text gap

Post by anthony »

The spacing between the baselines of text drawn in the one operation is controlled by pointsize.

That is the actual definition of the pointsize for a font. It actually does not mean text size, only distance from one line to the next. Some font I find look a lot smaller than other font at the same pointsize, however the distance between lines is the same for both of them!


Now for your problem. you could try removing the gap between the lines. Either by drawing each line separately, so you control the spacing, or by using 'chop' to chop out some pixel rows between the lines.

One method takes a existing image of text, segments it into separate lines, then modifies the images before re-joining... See the script http://www.imagemagick.org/Usage/scripts/divide_vert

Of course neither can be easy, and their are other solutions too, but what is best depends on what you are doing.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
hdagheda

Re: ImageMagick - multiline text gap

Post by hdagheda »

Thanks anthony, but then how i can specify font size?

i m looking at http://www.imagemagick.org/Usage/text/#pointsize

only pointsize wont be enough....i want bolder as will as big size fonts.

Can you please give me quick tricks :)

Thanks
Heena
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ImageMagick - multiline text gap

Post by anthony »

-pointsize is the font size (specified in terms of line to line spacing)

for bold or other attributes use -font to select the font to use EG: -font Arial-Bold
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply