python - 使用 PIL python 覆盖两个以上的图像
问题描述
嗨,我正在使用以下代码使用 PIL 模块合并多个图像
from PIL import Image
img0 = Image.open("w1.png")
img0 = img0.convert('RGBA')
img1 = Image.open("body.png")
img1 = img1.convert('RGBA')
img0.paste(img1, (0,0), img1)
img0.save('0.png')
img2 = Image.open("0.png")
img2 = img2.convert('RGBA')
img3 = Image.open("d1.png")
img3 = img3.convert('RGBA')
img2.paste(img3, (0,0), img3)
img2.show()
想知道是否有办法可以合并两个以上的图像。我有 8 张图像需要合并。
谢谢你的任何建议。
解决方案
would like to know if there is way i can merge more than two images. i have 8 images that i need to merge.
Just... keep paste
-ing new images on?
All Image.paste
does is merge the parameter image onto the subject, you can keep doing that, and it'll keep merging the new images.
推荐阅读
- javascript - JS Regex 匹配单词,但单词是动态的
- javascript - 在到达页脚之前隐藏 div
- python - python中金融文本的词干提取与词形还原[NLTK]
- c# - EF Core 代码优先:将最顶层的 ID 传播给所有子项和子项?
- python - MLP Regressor 比 Kernel Ridge Regression 最差
- python - Python有分支预测吗?
- java - 在 Java 代码中获取错误以查找有关子网和掩码的信息
- python - 无法注销用户 django 身份验证
- r - 通过标题和图表在 knitr 中循环
- android - android build failed gradle 无法解决