So for this project I\'m working on, I have 2 photos. These two photos need to be stitched together, one on the top and one on the bottom, and then you will be able to see t
I did vertical stitching like this - it is same code from @d3ming
07: def merge_images(file1, file2):
08: """Merge two images into one vertical image
09: :param file1: path to first image file
10: :param file2: path to second image file
11: :return: the merged Image object
12: """
13: image1 = Image.open(file1)
14: image2 = Image.open(file2)
15:
16: (width1, height1) = image1.size
17: (width2, height2) = image2.size
18:
19: # result_width = width1 + width2
20: result_width = width1
21: # result_height = max(height1, height2)
22: result_height = height1 + height2
23:
24: print (height2)
25:
26: result = Image.new('RGB', (result_width, result_height))
27: result.paste(im=image1, box=(0, 0))
28: result.paste(im=image2, box=(0, height1))
29: return result
line 19-22 - only height will change for stitching
paste the second image on line-28 box=(width1, 0) changes to box=(0, height1)