flux-lora/utilities/tile_example_images.py

20 lines
698 B
Python

from PIL import Image
image1 = Image.open('examples\\death-metal-album-cover-art\\1.png')
image2 = Image.open('examples\\death-metal-album-cover-art\\2.png')
image3 = Image.open('examples\\death-metal-album-cover-art\\3.png')
image4 = Image.open('examples\\death-metal-album-cover-art\\4.png')
# Assuming all images are the same size.
width, height = image1.size
grid_image = Image.new('RGB', (width * 2, height * 2))
# Place the images into the 2x2 grid.
grid_image.paste(image1, (0, 0))
grid_image.paste(image2, (width, 0))
grid_image.paste(image3, (0, height))
grid_image.paste(image4, (width, height))
grid_image.save("examples\\death-metal-album-cover-art\\preview.png")
grid_image.show()