Use PIL in Python to simple composite images
I have a render script that uses several Blender 3D instances on several machines to co-render one still image. The image is split into squares of 64 x 64 pixels. In the end, I have like 200 image files, each one with a puzzle piece of the whole.
Now I would like to assembe these pieces into whole with PIL and Python, but so far cannot figure out how. I am new to PIL, but in imagemagick, a convert image1.png image2.png image3.png +append finalimage.png works a charme. But convert chokes on so many image files, so I need something automatic and scalable.
I think that pictures are RGBA, so black should be the alpha channel and transparent.
I think I have to mention that the pieces are in the right position and that every piece has the original dimensions of the full picture, so it is not a problem figuring out where each piece should be. Just putting all the pictures on top of eachother and ignoring anything that is black would do the trick nicely.
How can I reach this with PIL? Which functions do I need for that? PIL does a lot of stuff, so finding my simple function is daunting.
Man, this is so tedious!
I have spend already hours trying to get the darn thing to do what I want. So far, I tried the composite and paste function of PIL and it always ends up with the same: it shows one image or the other, but never both.
Why is this so difficult? Do I really have to use Imagemagick over the command line with os.system? This cannot be seriously it???
At this point I wonder if PIL is defective, that it just does not work.
I mean, how hard is it?? You got two images, most of both is alpha (transparent). Some stuff is not, so you want to combine both, 100%, no blending or anything. The parts of the two images don't overlap, so no blending would be needed in any case.
I just don't get it.
|All times are GMT -5. The time now is 03:29 AM.|