Skip to content

Instantly share code, notes, and snippets.

@stephanie-w
stephanie-w / concat_images.py
Created January 3, 2021 15:35 — forked from njanakiev/concat_images.py
Concat images in a matrix grid with Python and PIL
import os
import random
from PIL import Image, ImageOps
def concat_images(image_paths, size, shape=None):
# Open images and resize them
width, height = size
images = map(Image.open, image_paths)
images = [ImageOps.fit(image, size, Image.ANTIALIAS)