Experiment with video 1

From XPUB & Lens-Based wiki
Revision as of 04:20, 7 December 2015 by SN (talk | contribs) (Created page with "Breaking down movies. <br /> <source lang="python"> from glob import glob from PIL import Image import os, sys from cStringIO import StringIO n = 0 pixel_lines = [] ff = glo...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Breaking down movies.

from glob import glob
from PIL import Image
import os, sys
from cStringIO import StringIO
n = 0
pixel_lines = []

ff = glob("frames/*")
ff.sort()
for f in ff:
	im = Image.open(f)
	x , y = im.size
	box = (x / 2, 0, (x / 2 + 1), y)
	region = im.crop(box)
	pixel_lines.append(region)

newim = Image.new('RGB', (len(ff),y))

print len(pixel_lines)

for pixel in pixel_lines:
	while n < len(pixel_lines):
		newim.paste(pixel_lines[n], (n, 0, n + 1, y))
		n = n + 1
newim.save('final.png')
newim.show()