Experiment with video 1: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
Breaking down movies. <br /> | Breaking down movies. <br /> | ||
<source lang="python"> | <source lang="python"> |
Revision as of 10:11, 7 December 2015
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()