【发布时间】:2017-02-14 02:08:39
【问题描述】:
我正在尝试使用 PIL 合成一些航拍图像并遇到了一些麻烦。我使用 PIL 来加载 this image 的代码:
composite = Image.new('RGBA', (256, 256))
url = 'http://...'
resp = requests.get(url)
content = StringIO(resp.content)
image = Image.open(content)
composite.paste(image, (0, 0), image)
当我拨打composite.paste() 时,PIL 给了我错误“ValueError:透明蒙版错误”。当我打印image.mode 时,果然是RGB 而不是预期的RGBA(paste() 需要)。
我下载的 PNG 的 alpha 通道在哪里?
【问题讨论】:
标签: python python-imaging-library