Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Image Blender
from PIL import Image
import os, math, sys, random
fileList = os.listdir(".")
(width, height) =[0]).size
nPhotos = len(fileList)
offset = width/float(nPhotos)
dst ="RGB", (width, height))
for index, file in enumerate(fileList):
src =
box = (int(math.floor(offset*index)), 0, int(math.ceil(offset*(index+1))), height)
print "Cropping " + file + " coords: "
print box
dst.paste(src.crop(box), box)"test.jpg", "JPEG")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.