-2

how to convert this command to python using wand ?

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

(this command adds a watermark to a photo)

Medya Gh
  • 3,697
  • 5
  • 18
  • 33

1 Answers1

3

Without seeing the expected result, I would assume you would want to composite with a dissolve operator. You can use Image.transparentize to adjust the watermark before applying the composite.

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')

how to watermark a photo

hint: Adjust the channel argument for greater control & effects.

emcconville
  • 20,969
  • 4
  • 43
  • 60