Controlling line height...

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
mattias

Controlling line height...

Post by mattias »

I use caption to generate word wrapped labels. Is there any way to control the lineheight of the text generated?

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

Re: Controlling line height...

Post by anthony »

That is called 'pointsize'. Sorry but that is actually what pointsize really means!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
mattias

Re: Controlling line height...

Post by mattias »

Yes - but if I would like it to be a value else then the standard for a given pointsize. Can that be done?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Controlling line height...

Post by anthony »

Not without further processing. I'm not certain if the freetype renderer actually has an option for 'line spacing', if it does christy may be happy to add a new setting option. If not well you will have to DIY

DIY can come in two forms...
  1. You can generate each line yourself and append or 'splice' in extra space at the top or bottom of each line. or position the lines on a larger virtual canvas (see IM examples "layers")
  2. Or you can use caption: to do all the word wrapping of the text, then use the IM examples script 'divide_vert' to split the image into a list of images and 'gaps'. You can then splice in extra space into the gap images, and append the image list together again.

    Code: Select all

    convert -size 200x -pointsize 20 caption:"This is a word wrapped line that is very very long" miff:- | divide_vert - miff:- | convert - -splice 0x2 -append expanded_caption.png
    Other options to divide_vert is to junk the gap images, though I wouldn't do that as the 'gaps' can be variable.

    ASIDE: this script was a proof of concept for a posible new option to IM to help split up and divide images into seperate parts based on either the input image, or that image and a mask showing the separate objects. Shame I have too many things to do, to implement it myself!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
mattias

Re: Controlling line height...

Post by mattias »

Ok - I understand. Thanks again.
Post Reply