我需要将两幅图像和一段短文本合并成一幅图像,格式为第一幅图像位于顶部,另一幅图像位于底部左侧,右下角的文本位于顶部。
生成的图像是400px * 600px,输入图像可以是任何尺寸,如果第一个图像小于400px,它将会位于顶部
Graphicsmagick有可能吗?
I need to combine 2 images and a short text into one image, in the format that the first image is at the top spanning a row, and the other image at bottom left, the text at bottom right.
The produced image is 400px * 600px, the input images can be any size, if the first image is less than 400px, it will be centered at the top
Is it possible with Graphicsmagick?
最满意答案
假设你已经有两个图像叫做:
top.png (顶部的图像横跨一行) left.png ( 左下角的其他图片)首先,您必须创建包含文字的第三个缺失图像(称为text.png ):
gm convert -size 200x300 xc:#7F0000 -pointsize 80 -font Arial -fill white -draw "text 10,150 'text'" text.png那么你可以在底部构成两个图像(创建一个名为bottom.png的图像):
gm montage left.png -geometry 200x300+0+0 text.png -tile 2x1 bottom.png最后你可以用上面和下面的部分组成:
gm montage top.png -geometry 400x300+0+0 bottom.png -tile 1x2 result.png结果将是一个名为result.png的图像,大小:400x600
top.png:
left.png:
result.png:
使用GraphicsMagick 1.3.18测试Windows 2013-03-10 Q8
Assuming you already have two images called:
top.png (image at the top spanning a row) left.png (other image at bottom left)first of all you have to create the third missing image (called text.png) containing your text:
gm convert -size 200x300 xc:#7F0000 -pointsize 80 -font Arial -fill white -draw "text 10,150 'text'" text.pngthen you can compose the two images in the bottom part (creating an image called bottom.png):
gm montage left.png -geometry 200x300+0+0 text.png -tile 2x1 bottom.pngand finally you can compose upper and lower parts with:
gm montage top.png -geometry 400x300+0+0 bottom.png -tile 1x2 result.pngthe result will be an image called result.png, size: 400x600
top.png:
left.png:
result.png:
Tested on Windows with GraphicsMagick 1.3.18 2013-03-10 Q8
更多推荐
发布评论