Drkcore

20 10 2009 Python PIL glitch Tweet

PILでglitch

早朝グリッチ。PILのputpixelは遅いので、1.1.6からはim.loadを使えとのこと。

import Image,sys
from random import randint

file = sys.argv[1]
im = Image.open(file)

width,height = im.size
slide_x = 0
slide_y = 0
rand_slide_x = randint(0,14)
rand_slide_y = randint(0,4)

pix = im.load()
for h in range(height):
    slide_x += rand_slide_x
    slide_y += rand_slide_y

    for w in range(width):
        new_h = h + slide_y
        new_w = w + slide_x
        if new_h >= height: new_h = h
        if new_w >= width: new_w = w
        pix[w,h] = pix[new_w,new_h]

im.show()
im.save("glitch091020.jpg")

1255993806

そしてGlitch: Perfet Imperfectionsもポチッた

ProductName Glitch: Designing Imperfection

Mark Batty Publisher / 2839円 ( 2009-09-16 )


参考

  • today's glitch 2
  • きょうのglitch

About

  • もう5年目(wishlistありマス♡)
  • 最近はPythonとDeepLearning
  • 日本酒自粛中
  • ドラムンベースからミニマルまで
  • ポケモンGOゆるめ

Tag

Python Deep Learning javascript chemoinformatics Emacs sake and more...

Ad

© kzfm 2003-2021