1

我拍了这张照片:

在此处输入图像描述

并做到了:

convert -extent 800x600 -background transparent -matte -virtual-pixel transparent -distort Perspective '0,0,369,225 0,255,357,195 255,0,400,218 255,255,400,187' image1.png image2.png 

结果(故意使用显示的方格模式来显示透明度):

在此处输入图像描述

如何使讨厌的灰色区域变得透明?

4

1 回答 1

3

添加“-mattecolor 透明”:

convert -extent 800x600 -mattecolor transparent -background transparent -matte -virtual-pixel transparent -distort Perspective '0,0,369,225 0,255,357,195 255,0,400,218 255,255,400,187' test.png test2.png

您的示例图像与您的示例参数,使用 mattecolor:

具有正确透明度的示例图像

使用透视图时 mattecolor 选项的文档说明(http://www.imagemagick.org/script/command-line-options.php):

地平线是抗锯齿的,并且可以使用 -mattecolor 设置设置“天空”颜色。

于 2012-07-09T06:39:09.373 回答