【发布时间】:2019-01-03 17:28:39
【问题描述】:
我正在尝试从文本生成图像。要求是:文本左对齐,垂直居中,尽可能大,最大。分辨率 1920x1080。
这就是我所拥有的:
convert -background white -fill black \
-font "fonts/DejaVuSansMono.ttf" \
-size 1920x1080 label:'Text \nloooooooooooooooooooooooooong text\nand another' \
-gravity West image.png
它工作得很好,但它不会垂直居中。
看起来像这样: https://imgur.com/rJLxJO2.png
但我希望它看起来像这样:https://imgur.com/IVrydty.png
我可以使用 -size x1080 并使用第二个命令将该图像放入空白图像的中心,但这并不能确保它不会太宽。
【问题讨论】:
标签: bash imagemagick image-manipulation imagemagick-convert