Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- import lc, ascii_binary
- def getParts(object, l):
- cma = {'1':(255,255,255),'0':(0,0,0)}
- data = [ascii_binary.binencode(i) for i in lc.recur(object, l)]
- full = [cma[i] for i in ''.join(data)]
- return full[:l]
- def avTwo(t1, t2):
- return tuple([(a+b)/2 for a, b in [i for i in zip(t1, t2)]])
- def avList(l1, l2):
- return [avTwo(a, b) for (a, b) in zip(l1, l2)]
- try:
- b = Image.open('rail.jpg')
- width, height = b.size
- ob = b.getdata()
- ob = list(ob)
- new = [lc.vectorAverage(i) for i in ob]
- total = avList(new, getParts("dick", (width*height)))
- img = Image.new('RGB', (width, height), "white")
- img.putdata(total)
- img.show()
- except Exception, e:print str(e)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement