Appending text and interline-spacing
Posted: 2014-10-08T14:45:03-07:00
Hello!
I'm having some trouble understanding creating texts with ImageMagick, more specificaly with the space between each line. I want to create texts and know beforehand what the height of the texts will be, I do not get this to work.
I'm running the following command:
convert -gravity Center -size 56x704 xc:none -font "Verdana" -density 72 -pointsize 88 -fill green -annotate 0 "1\n2\n3\n4\n5\n6\n7\n8" text.jpg
This will create a text with 8 lines, 8x88 = 704 so I expect the text to perfectly fill the image, however there seems to be to much space between each line and the text does not fit, it is to large.
After some testing I found out that if I reduce the -interline-spacing by 0.2 times the fontsize the text seems to pit perfectly:
convert -gravity Center -size 56x704 xc:none -font "Verdana" -density 72 -pointsize 88 -interline-spacing -17.6 -fill green -annotate 0 "1\n2\n3\n4\n5\n6\n7\n8" text.jpg
In addition there also seems to be different from font to font, for example for Times New Roman the proper value seems to be 0.1 * font size.
Any ideas what I'm missing?
My enviroment is running ImageMagick-6.8.8-Q16 under Windows7
I'm having some trouble understanding creating texts with ImageMagick, more specificaly with the space between each line. I want to create texts and know beforehand what the height of the texts will be, I do not get this to work.
I'm running the following command:
convert -gravity Center -size 56x704 xc:none -font "Verdana" -density 72 -pointsize 88 -fill green -annotate 0 "1\n2\n3\n4\n5\n6\n7\n8" text.jpg
This will create a text with 8 lines, 8x88 = 704 so I expect the text to perfectly fill the image, however there seems to be to much space between each line and the text does not fit, it is to large.
After some testing I found out that if I reduce the -interline-spacing by 0.2 times the fontsize the text seems to pit perfectly:
convert -gravity Center -size 56x704 xc:none -font "Verdana" -density 72 -pointsize 88 -interline-spacing -17.6 -fill green -annotate 0 "1\n2\n3\n4\n5\n6\n7\n8" text.jpg
In addition there also seems to be different from font to font, for example for Times New Roman the proper value seems to be 0.1 * font size.
Any ideas what I'm missing?
My enviroment is running ImageMagick-6.8.8-Q16 under Windows7