與 ImageMagick 的邊框

與 ImageMagick 的邊框

裁剪圖像並調整其大小以適合 a5 pdf我問如何將影像放入橫向 A5 中。

現在我想為圖像添加邊框或框架,並在底部添加標語(在底線和圖像之間)。

使用 ImageMagikc 可以嗎?

答案1

您可以在以下人員的幫助下做到這一點-draw操作員:

convert in.png -fill none -stroke black -strokewidth ${WIDTH} -draw "rectangle ${X1},${Y1} ${X2},${Y2}" out.png

其中: WIDTH- 描邊寬度
X1- 左上角的 x 座標
Y1- 左上角的 y 座標
X2- 右下角的 x 座標
Y2- 右下角的 y 座標

例如,對於您想要裁剪+調整大小+轉換為 PDF 的其他影像,您可以執行:

convert out.png -resize 2362x1630 -background white -gravity center -extent 2480x1748 \
-fill none -stroke black -strokewidth 10 -draw "rectangle 20,20 2460,1728" out.pdf

相關內容