Python: combine two PNG files as layers [duplicate]

放肆的年华 提交于 2021-02-16 14:38:22

问题


Possible Duplicate:
How to merge a transparant png image with another image using PIL

I have a couple of PNG files:

http://dl.dropbox.com/u/6599273/testing/image1.png
http://dl.dropbox.com/u/6599273/testing/image2.png

As you can see, those images have transparent parts. When you put one on top each other they will form a nice looking image. Here, the composed image:

http://dl.dropbox.com/u/6599273/testing/image_composed.png

I composed the image using paint.net in a really straightforward way (drag&drop). But I need to do it programatically, using Python. And generalized to thousand of images like those (all same dimensions: 256x256 px)

How could I do it? I'm experimenting with PIL. Is it possible?

Many thanks in advance, and best regards


回答1:


This question was already answered at How to merge a transparant png image with another image using PIL. Use the paste method of PIL images



来源:https://stackoverflow.com/questions/8881002/python-combine-two-png-files-as-layers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!