2017-02-22 29 views
1

ImageMagickを初めて使用しました.3つの異なる画像に3種類のラベルを追加して、それぞれがコーナーにある背景画像に挿入しようとしています。ImageMagickを使用して複数の画像とテキストを結合する

すべての画像とテキスト文字列は手前にありません。そのため、これを処理するスクリプトを作成しています。私の最新の(失敗した)試みは次のとおりです:

convert -page +0+0 ${bg}.png \ 
    \(-page +0+0 -gravity south -pointsize 16 \ 
    -stroke '#000C' -strokewidth 4 -annotate 0 "$label" \ 
    -stroke none -strokewidth 20 -fill white -annotate 0 "$label" \) \ 
    \(-page +0+0 ${im1}.png \ 
    -stroke '#000C' -strokewidth 2 -annotate 0 "text1" \ 
    -stroke none -fill white -annotate 0 "text1" \) \ 
    \(-page +${hor_offset}+0 {im2}.png \ 
    -gravity south -pointsize 14 \ 
    -stroke '#000C' -strokewidth 2 -annotate 0 "text2" \ 
    -stroke none -fill white -annotate 0 "text2" \) \ 
    \(-page +0+${ver_offset} ${im3}.png \ 
    -stroke '#000C' -strokewidth 2 -annotate 0 "text3" \ 
    -stroke none -fill white -annotate 0 "text3" \) \ 
    +page -flatten out.png 

私は以前より良い結果を出しましたが、主に偶然であり、専門家の助けを求めることにしました。

最終的な結果は次のようになります。Expected result

答えて

0

-pageは-gravity尊重していません。ページは常に画像の北西の角(左上)を基準にしています。代わりに、-graposと-geometryを-compositeと組み合わせて使用​​することもできます。 1つのイメージを作成し、正しい位置にバックグラウンドで合成します。その結果の繰り返しとオーバーレイする別の画像。 http://www.imagemagick.org/Usage/layers/#convert

関連する問題