I use caption to generate word wrapped labels. Is there any way to control the lineheight of the text generated?
/mattias
Controlling line height...
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Controlling line height...
That is called 'pointsize'. Sorry but that is actually what pointsize really means!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Controlling line height...
Yes - but if I would like it to be a value else then the standard for a given pointsize. Can that be done?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Controlling line height...
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...
DIY can come in two forms...
- 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")
- 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.
Other options to divide_vert is to junk the gap images, though I wouldn't do that as the 'gaps' can be variable.
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
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/
https://imagemagick.org/Usage/