雑多な技術系メモ

自分用のメモ。内容は保証しません。よろしくお願いします。

Pillow で画像をグレー(灰色)に

まず元の画像

>>> img = Image.open("./crowncat4020138_TP_V.jpg")
>>> plt.imshow(img)
<matplotlib.image.AxesImage at 0x7f62e821bac8>

f:id:ttt242242:20190826082259p:plain

グレーにする

>>> img_gray = img.convert("LA")
>>> plt.imshow(img_gray)
<matplotlib.image.AxesImage at 0x7f62e8043160>

f:id:ttt242242:20190826082316p:plain