Skip to content

Instantly share code, notes, and snippets.

@pocket7878
Created June 28, 2015 06:13
Show Gist options
  • Save pocket7878/46ff5cd0a76f6ba52364 to your computer and use it in GitHub Desktop.
Save pocket7878/46ff5cd0a76f6ba52364 to your computer and use it in GitHub Desktop.
rainbow.py
from PIL import Image, ImageDraw
import photos
base = photos.capture_image()
w = base.size[0]
h = base.size[1]
rainbow = Image.new(base.mode, base.size, "white")
level = 6
hh = h / level
draw = ImageDraw.Draw(rainbow)
for i in range(0,level):
draw.rectangle([(0, i * hh),(w,i*hh+hh)], fill=("hsl(%s,100%%,50%%)" % (i * 360 / level)))
res = Image.blend(base, rainbow,0.5)
res.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment