Image Magick - Converting text to image - is there a way to center the text to the middle of the image?

前端 未结 2 1483
遇见更好的自我
遇见更好的自我 2021-01-02 02:46

I have a simple text file that reads something like \"It is 28 degrees today\" I am trying to use imagemagick to center it to the middle of the image. The command i am using

相关标签:
2条回答
  • 2021-01-02 03:20

    Look At this

    convert temp.jpg -gravity Center  -pointsize 30 -annotate 0 'Love you      
    mom' temp1.jpg 
    

    'i love u mom' text word gravity positioning center place of the text

    0 讨论(0)
  • 2021-01-02 03:21
    convert \
        -size 165x70 \
        xc:lightblue \
        -font Bookman-DemiItalic \
        -pointsize 12 \
        -fill blue \
        -gravity center \
        -draw "text 0,0 'It is 28 degrees today'" \
        image.png
    

    If you want to pull the input from an existing file, just feed that to the draw command:

    convert \
        -size 165x70 \
        xc:lightblue \
        -font Bookman-DemiItalic \
        -pointsize 12 \
        -fill blue \
        -gravity center \
        -draw "text 0,0 '$(cat file.txt)'" \
        image.png
    
    0 讨论(0)
提交回复
热议问题