SHARE
TWEET

Chaotic Pixels 0.0.1

jeffwincek Nov 10th, 2011 24 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Jeff Wincek
  2. import Image, ImageDraw, math, ImageFilter, random
  3.  
  4. # needs a file with a long number in it to run
  5. # or some other way to generate numbers
  6. f = open('numString.txt')
  7. numberString = str(f.read())
  8.  
  9. #print numberString
  10. worldSize = (172,172)
  11. im = Image.new('L',worldSize,"white")
  12. draw = ImageDraw.Draw(im)
  13. stringLength = len(numberString)
  14.  
  15. holdOver = 0
  16.  
  17. #print numberString
  18. def printSomeLines(currentX,currentY):
  19.     for k in range(0,stringLength):
  20.         try:
  21.             draw.point((currentX,currentY), fill = int(numberString[k]) * 10)
  22.         except ValueError:
  23.             print "caught error"
  24.             k+=1
  25.         if currentX+1 < worldSize[0]:
  26.             currentX +=1
  27.         else:
  28.             currentY += 1
  29.             currentX = 0
  30.     print "currentY = " + str(currentY)
  31.     return currentY
  32.  
  33. for w in range(0,(stringLength / worldSize[0])/worldSize[1]):
  34.     if w == 0:
  35.         howMany = printSomeLines(0,0)
  36.     else:
  37.         printSomeLines(0,w*howMany)
  38. #while holdOver+15 < worldSize[1]:
  39. #    holdOver = holdOver+ printSomeLines(0,holdOver)
  40. #    print holdOver
  41. im.show()
  42. print "length of input string:" + str(stringLength)
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. #comment to stop scrolling
  53.  
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top