Drkcore

23 11 2010 Python Tweet

画像ファイルのピクセルのRGB値の合計のmod3

画像ファイルのピクセルのRGB値の合計のmod3を取って文字列にする

def parse_image(file):
    modstr = ""
    im = Image.open(file)
    height,width = im.size
    for h in range(height):
        for w in range(width):
            r,g,b = im.getpixel((h,w))
            modstr += str((r+g+b)%3)
    return modstr

でもちょっと遅い。

About

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

Tag

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

Ad

© kzfm 2003-2021