Search code examples
imagemagickmontage

How to put text on top of image (above)?


I have came up with this:

montage -background Orange -label "Faerie Dragon" -gravity South test.png -geometry "100%" -font TREBUC.ttf -pointsize 25 out.png

It adds text "Fearie Dragon" with font Trebuchet in size 25 on orange background below the image test.png and doesn't scale original image.

The only problem is: how can I put the text above the image not below? Gravity option doesn't seem to do anything.


Solution

  • You can put the annotation on the upper side of the image using convert instead of montage with the following command:

    convert test.png -pointsize 25 -gravity North -background Orange -splice 0x32 -annotate +0+4 "Faerie Dragon" out.png
    

    This is the output of your command with montage:

    enter image description here

    This is the output of the command with convert:

    enter image description here

    Starting from a 400x300 image both commands generate a 400x332 image.

    Tested with ImageMagick 7.0.5-3 on Windows