Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- """
- Created on Sun May 17 17:07:43 2015
- @author: JC
- """
- import os
- from PIL import Image
- from pylab import *
- path = r'Your path here'
- jpglist = os.listdir(path)
- outfile = os.path.join(path,'Milow_Star_Trail.jpg')
- # check size of one of the photos first
- om = zeros((683, 1024, 3),dtype=uint8)
- for jpg in [os.path.join(path,f) for f in os.listdir(path) if f.endswith('Star_Field.JPG')]:
- pil_im = Image.open(jpg)
- im = array(pil_im)
- for row in range(im.shape[0]):
- if row%250 == 0:
- print row
- for col in range(im.shape[1]):
- r,g,b = im[row,col,:]
- r0,g0,b0 = om[row,col,:]
- if long(r)*long(r)+long(g)*long(g)+long(b)*long(b) > long(r0)*long(r0)+long(g0)*long(g0)+long(b0)*long(b0):
- om[row,col,:] = array([r,g,b])
- print jpg
- print im.shape
- Image.fromarray(om).save(outfile)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement