【发布时间】:2013-01-23 19:46:05
【问题描述】:
我有大量不同尺寸的图片,从 16x16 到 512x512。
我想在每张图片上附加一个黑色标签,上面写着“演示版”。
由于图像的大小差异很大,我希望标签大小与图像相关。我不想让图像变宽。
请帮忙。
【问题讨论】:
标签: image-processing imagemagick image-manipulation
我有大量不同尺寸的图片,从 16x16 到 512x512。
我想在每张图片上附加一个黑色标签,上面写着“演示版”。
由于图像的大小差异很大,我希望标签大小与图像相关。我不想让图像变宽。
请帮忙。
【问题讨论】:
标签: image-processing imagemagick image-manipulation
这是一个 php 版本,因为这是我使用的 - 你也没有说你正在使用什么平台等。这将在图像下方添加一个标签,因为我认为这是您想要的 - 如果这是您想要的第二个示例,您可以改为添加水印。
exec("montage -geometry +0+0 -background skyblue -label \"Sunflower\" original.jpg output.jpg");
带有浮雕文字的水印
// Get the size of the image
$size = getimagesize("$input14");
// Size for watermark - scaled to fit the image
$width = $size[0]*.9;
$height = $size[0]*.25;
// Create an image with the text
$cmd = "-size {$width}x{$height} -background none -font Utopia-bold ".
" -fill white -gravity center caption:\"Copyright of Rubblewebs\" ".
" -shade 240x40";
exec("convert $cmd font.png ");
// Add the text image to the photo
exec("composite -watermark 30% -gravity south font.png $input14 embossed.png");
// Delete the tempory image
unlink ('font.png');
【讨论】: