Skip to content

Instantly share code, notes, and snippets.

@kerenskybr
Last active September 19, 2020 13:48
Show Gist options
  • Save kerenskybr/9bc81f1e21a60f66d7f122a80d39971e to your computer and use it in GitHub Desktop.
Save kerenskybr/9bc81f1e21a60f66d7f122a80d39971e to your computer and use it in GitHub Desktop.
Concat two images towards the height
from PIL import Image
def concat_images(im1, im2):
""" Concat two images towards the height
"""
dst_img = Image.new('RGB', (min(im1.width, im2.width), im1.height + im2.height))
dst_img.paste(im1, (0, 0))
dst_img.paste(im2, (0, im1.height))
return dst_img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment