2009年8月18日火曜日

I'm back home.

This is my first dialy in a while.I'm back from New Orleans siggraph.
I could get a great motivation to study Houdini,python and English!!

Finally I could know little bit about python of Houdini.

This is my first code by using PIL lib.

import PIL.Image
import PIL.ImageDraw

WIDTH = 8
HEIGHT = 8
BLOCK = 2

image = PIL.Image.new('RGB', (WIDTH, HEIGHT)) #'1': binary, 'L': gray scale, 'RGB': RGB color
d = PIL.ImageDraw.Draw(image)
colDic = {(0, 0): (175, 89, 13), (0, 1): (50, 65, 60), (1, 0): (165, 123, 46), (1, 1): (45, 100, 115)}

for y in range(HEIGHT):
for x in range(WIDTH):
d.point((x, y), colDic[((x + y) / BLOCK % 2, (x - y) / BLOCK % 2)])

image.save('c:/check.png', 'PNG')

0 件のコメント :