Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- import itertools
- def chop(object,n):
- return [object[i:i+n] for i in range(0, len(object), n)]
- def organize(object):
- a = []
- b = []
- c = []
- for i in object:
- a.append(i[0])
- b.append(i[1])
- c.append(i[2])
- a = (sum(a)/len(a))
- b = (sum(b)/len(b))
- c = (sum(c)/len(c))
- total = []
- for i in range(len(object)):
- total.append((a,b,c))
- return total
- def rngmirror(object):
- from lc import halflist
- full = halflist(object)
- final = full[0]+list(reversed(full[1]))
- return final
- def gradientize(object):
- increments = range(1, len(object)+1)
- increments = rngmirror(increments)
- total = []
- for i, i2 in zip(object, increments):
- tep = []
- for a in i:
- tep.append(a*i2/len(object))
- total.append(tuple(tep))
- return total
- img = Image.open('ex.jpg')
- data = img.getdata()
- data = list(itertools.chain(*[gradientize(a) for a in [organize(i) for i in chop(list(data), img.size[0]/8)]]))
- es = Image.new('RGB', img.size, "white")
- es.putdata(data)
- es.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement