-2

如何使用 wand 将此命令转换为 python?

composite -dissolve 30% -gravity south output-file.png input-file.jpg watermark.jpg

(此命令为照片添加水印)

4

1 回答 1

3

在没有看到预期结果的情况下,我会假设您想要使用溶解操作符进行合成。您可以在应用合成之前使用Image.transparentize调整水印。

from wand.image import Image
from wand.compat import nested

images = (
  'rose.png',
  'wizard.png'
)

with nested(Image(filename=images[0]),
            Image(filename=images[1])) as (rose, wizard):
  rose.transparentize(0.33)
  wizard.composite_channel("all_channels",
                           rose,
                           "dissolve",
                           wizard.width/2 - rose.width/2,
                           wizard.height - rose.height)
  wizard.save(filename='out.png')

如何给照片加水印

提示:调整通道参数以获得更好的控制和效果。

于 2014-12-23T20:56:08.527 回答