Lad wrote:
> I really would like to have ALL pictures in one file.

import Image

def merge_images( input_files, output_file ) :
    img_list = [Image.open(f) for f in input_files]
    out_width = max( [img.size[0] for img in img_list] )
    out_height = sum( [img.size[1] for img in img_list] )
    out = Image.new( 'RGB', (out_width,out_height) )
    y = 0
    for img in img_list :
        w,h = img.size
        out.paste( img, (0,y,w,y+h) )
        y += h
    out.save( output_file )

Use like this:
>>> merge_images( ['1.jpg','2.jpg','3.jpg'], 'output.jpg' )

Regards
Sreeram

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to