Last active
January 30, 2017 02:34
-
-
Save m5knt/63b238165dafdb1d55acf73658047110 to your computer and use it in GitHub Desktop.
pythonで点を打つ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python -B | |
# -*- mode: python; coding: utf-8 -*- | |
from PIL import Image, ImageDraw | |
# 参考 http://qiita.com/suto3/items/87af35517f2a8c3bc22e | |
''' | |
pip install pillow | |
''' | |
img = Image.new('RGBA', (256, 256), (0, 0, 0, 0)) | |
draw = ImageDraw.Draw(img) | |
dots = 0 | |
for a in range(0, 256, 255): | |
for b in range(0, 256, 8): | |
for g in range(0, 256, 8): | |
for r in range(0, 256, 8): | |
red = r | r >> 5 | |
green = g | g >> 5 | |
blue = b | b >> 5 | |
draw.point((dots & 0xff, dots / 0x100), (red, green, blue, a)) | |
dots += 1 | |
img.save('rgba5551.png') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment