document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. # -*- coding: utf-8 -*-
  2. """
  3. Created on Sun May 17 17:07:43 2015
  4.  
  5. @author: JC
  6. """
  7.  
  8. import os
  9. from PIL import Image
  10. from pylab import *
  11.  
  12. path = r\'Your path here\'
  13. jpglist = os.listdir(path)
  14.  
  15. outfile = os.path.join(path,\'Milow_Star_Trail.jpg\')
  16. # check size of one of the photos first
  17. om = zeros((683, 1024, 3),dtype=uint8)
  18.  
  19. for jpg in [os.path.join(path,f) for f in os.listdir(path) if f.endswith(\'Star_Field.JPG\')]:
  20.     pil_im = Image.open(jpg)
  21.     im = array(pil_im)
  22.  
  23.     for row in range(im.shape[0]):
  24.         if row%250 == 0:
  25.             print row
  26.         for col in range(im.shape[1]):
  27.             r,g,b = im[row,col,:]
  28.             r0,g0,b0 = om[row,col,:]
  29.            
  30.             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):
  31.                 om[row,col,:] = array([r,g,b])
  32.     print jpg
  33.     print im.shape
  34.    
  35.    
  36. Image.fromarray(om).save(outfile)
');