Help us understand the problem. What is going on with this article?

Pythonで画像処理

More than 3 years have passed since last update.

PILの導入

PIL(Python Imaging Library)を使います

PILについてはこちら
http://www.lifewithpython.com/2013/09/pil.html

ダウンロード

http://www.pythonware.com/products/pil/
公式サイトから自分のOSなどにあったものをダウンロードしてください

ダウンロードして、そのフォルダに移動した後に以下の手順でインストールします。

cd Imaging-1.1.7
sudo python setup.py install

画像をマスクする

mask.py
from PIL import Image, ImageOps
mask = Image.open("マスク画像のパス")
org = Image.open("元画像のパス")
sq = ImageOps.fit(sq, (400, 400), method = Image.LANCZOS)
sq.putalpha(mask.convert("L"))
sq.save("丸く切りぬいた画像の保存先のパス")

(おまけ)QRコードを読み書き

http://nixeneko.hatenablog.com/entry/2016/01/25/023703
http://qiita.com/kiyota-yoji/items/7fe134a64177ed708fdd

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away