This is NOT a bug!
Your canvas is just not big enough to contain that text, at that point size.
IM centers fonts based on the fonts defined 'drawing box' for the font. If you would like to see this box set "
-undercolor red" which gets the font library to draw the drawing area in red.
The large amount of space above the text is actuall for line spacing as defined by the pointsize. Remember pointsize actually represents line spacing, and NOT text size. though they are related.
See IM Examples, Resolution, Pointsize, and Actual Font Size
http://imagemagick.org/Usage/text/#pointsize
IM can size the image to fit that drawing box by using "label:" (this ignored the -undercolor setting)
Code: Select all
convert -background black -fill white -font Arial -pointsize 120 label:'Alea iacta est g' image.jpg
this you will see did contain ALL the text, but the image is larger.
If you want a true center regardless of the fonts 'drawing area' the best way is to create a label image, the
-trim that image. this can then be center overlaid onto a canvas the size you want. Of course if the canvas is not big enough, then the overlay will still be cropped, but it will be correctly centered.
Code: Select all
convert -background black -fill white -font Arial \
-pointsize 120 label:'Alea iacta est g' -trim +repage \
-size 800x120 xc:black +swap -gravity center -composite \
image.jpg
For more information on what the above is doing, see IM examples. Text handling, Cutting and Bordering, and Alpha Composition.