I have a problem. The following code does work and it combines the two images. But the background-image in the final composing is completely black.
Any guesses, what's the problem here?
from wand.image import Image
with Image(filename=bgimage) as back:
with Image(filename=qrcode) as front:
with Image(width=back.width, height=back.height) as new_image:
new_image.composite(front, left=1000, top=900)
new_image.save(filename=qr_output)
Try removing the new_image
section, and simplify everything.
with Image(filename="wizard:") as back:
with Image(filename="rose:") as front:
back.composite(front,
top=back.height-front.height,
left=back.width-front.width)
back.save(filename="/tmp/output.png")
If your attempting to reuse back
instance, then leverage wand.image.Image.clone
with Image(filename=bgimage) as back:
with Image(filename=qrcode) as front:
with back.clone() as new_image:
new_image.composite(front, left=1000, top=900)
new_image.save(filename=qr_output)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.