[英]Wand: Image.composite turns bg-image black
我有個問題。 以下代碼可以正常工作,並且將兩個圖像合並在一起。 但是最終構圖中的背景圖像是完全黑色的。
任何猜測,這是什么問題?
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)
嘗試刪除new_image
部分,並簡化所有操作。
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")
如果您嘗試重用back
實例,請利用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)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.