Sha256: aaac33d8ffc530f85efab77a645357c21fdcae71821516d5f55b8c8c01fe87c1

Contents?: true

Size: 765 Bytes

Versions: 5

Compression:

Stored size: 765 Bytes

Contents

# Make a mosaic with images
import sys
import os
from PIL import Image

RES_X = 5000
RES_Y = 5000
path = './renders/'
files = [path + f for f in os.listdir(path) if os.path.isfile(os.path.join(path, f))]
images = map(Image.open, files)
widths, heights = zip(*(i.size for i in images))

total_width = images[0].size[0] * 4
total_height = total_width

res = Image.new('RGB', (total_height,total_width))
print('stitching ' + str(len(files)) + ' images')

x_offset = 0
y_offset = 0
for file in files:
    print(file)
    image = Image.open(file)
    print(image.size)
    res.paste(image, (x_offset, y_offset))
    x_offset += image.size[0]
    if x_offset > total_width:
      print('reset')
      y_offset += image.size[1]
      x_offset = 0

res.save('./mosaic.png')

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
glitch3d-0.2.3.3 image.py
glitch3d-0.2.3.2 image.py
glitch3d-0.2.3.1 image.py
glitch3d-0.2.3.0 image.py
glitch3d-0.2.2.9 image.py