How to modify the vertical space ?

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?".
Post Reply
Mumu_cn

How to modify the vertical space ?

Post by Mumu_cn »

I use convert to convert a font png file like this,

convert -background '#000000' -fill '#ffffff' -font /tmp/MSYHBD.TTF -pointsize 16 -gravity north -size 16x2048 label:@chfile font.png

but, I found the vertical space of the characters in png file is high. I hope the characters arrenged one after another form top to bottom with the smallest space.

could someone give me some advice, thanks very much .
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to modify the vertical space ?

Post by fmw42 »

I don't think IM has line spacing attribute control, but see

http://www.imagemagick.org/Usage/text/#kerning

I will defer to the experts on this.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: How to modify the vertical space ?

Post by anthony »

No we have controls to add/remove inter-character and inter-word, but we don't have inter-line spacing controls yet

One 'slow' technique is to use a script like divide-vert
http://www.imagemagick.org/Usage/scripts/divide-vert
to split the text lines into a sequence of line/blank images, and then splice an extra row to each image, before appending them back together.

See the top of the script for various techniques.

This has not been Exampled. The script is a 'proof of concept' for one form of image segmention.
As is the 'segment_image' script in the same directory.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Mumu_cn

Re: How to modify the vertical space ?

Post by Mumu_cn »

anthony wrote:No we have controls to add/remove inter-character and inter-word, but we don't have inter-line spacing controls yet

One 'slow' technique is to use a script like divide-vert
http://www.imagemagick.org/Usage/scripts/divide-vert
to split the text lines into a sequence of line/blank images, and then splice an extra row to each image, before appending them back together.

See the top of the script for various techniques.

This has not been Exampled. The script is a 'proof of concept' for one form of image segmention.
As is the 'segment_image' script in the same directory.
thank u very much , i will try
Post Reply