ImageMagick Convert:如何在RGB图像上添加alpha阴影?

时间:2014-04-21 14:12:41

标签: image-processing imagemagick imagemagick-convert

给定RGB图像:

enter image description here

给定灰度,不透明度0%到不透明度100%黑色图像:

enter image description here

如何使用shell命令在RGB图像上添加alpha阴影?(优先使用ImageMagick转换)

2 个答案:

答案 0 :(得分:1)

我相信这个例子" Using Masks with Images"涵盖了这个。只需禁用Alpha通道,然后将第二个图像复制为不透明度合成。添加-negate选项以反转0%~100%不透明度 - 如果需要。

 convert map_image.png elevation_mask.png \
         -alpha Off -compose CopyOpacity -composite \
         out.png

alpha mask

答案 1 :(得分:1)

我会使用Multiply运算符组合图像。命令

convert src.png overlay.png -compose Multiply -geometry 948x630 -composite out.png

产生

enter image description here