如何使用 imagemagick 为照片添加描述?

How to add description to photo using imagemagick?

我想为这张照片添加描述:

所以它看起来像这样:

我使用的命令是:

montage -pointsize 14 -gravity NorthWest  -title "\nName: $filename\nOrigin:$origin \n Price:$price "  input.png output.png

但我得到的是:

我该如何解决这个问题?我需要描述出现在左上角不超过图片总高度 20% 的边缘吗?

你可以这样做:

#!/bin/bash
name="Flower"
origin="Moon"
price="£3.99"
magick flower.jpg -size "%[fx:w/4]x%[fx:h/4]" caption:"Name: $name\nOrigin: $origin\nPrice:$price" -trim +swap -append result.jpg