【发布时间】:2018-02-02 19:13:18
【问题描述】:
我有一个基本图像,在它之上,我正在尝试粘贴一个 50% alpha 的黑色条带。这是我一直在测试的:
from PIL import Image, ImageFont, ImageDraw
base_width, base_height = base_img.size
if base_img.mode != 'RGB':
base_img = base_img.convert("RGB")
black_strip = Image.new('RGBA', (base_width, 20),(0,0,0,128)) #creating the black strip
offset = (0,base_height/2)
base_img.paste(background,offset)
生成的黑色条不具有 alpha 透明度;它是完全坚固的。示例:
有人可以帮我改进吗?
【问题讨论】:
标签: python python-imaging-library pillow