VincentZB's picture
Duplicate from king007/Stable-Diffusion-ControlNet-WebUI
4ec2f90
raw
history blame contribute delete
285 Bytes
from PIL import Image
def image_grid(imgs, rows, cols):
assert len(imgs) == rows * cols
w, h = imgs[0].size
grid = Image.new("RGB", size=(cols * w, rows * h))
for i, img in enumerate(imgs):
grid.paste(img, box=(i % cols * w, i // cols * h))
return grid