LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-24-2010, 07:45 AM   #1
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Rep: Reputation: 56
Smile Use PIL in Python to simple composite images


Hi

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.

Cheers

Markus
 
Old 06-25-2010, 08:57 AM   #2
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Original Poster
Rep: Reputation: 56
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.

Markus
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to read images using 'pymorph' in python matrix13 Linux - Software 1 02-13-2009 11:05 PM
Reading embedded images with python xpromisex Programming 0 06-01-2007 05:33 PM
Is there a simple utility that can stitch multiple images into one? davee Linux - Software 3 08-09-2004 02:28 AM
a need simple a program to resize images while keeping the aspect ratio Necronomicom Linux - Software 3 07-10-2004 12:21 AM
Python: Bit masking images? sienarot Programming 1 03-06-2004 02:46 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration