この文書の現在のバージョンと選択したバージョンの差分を表示します。
| 両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
|
プログラミング:python:pythonライブラリ:pillow:基本的な使い方 [2019/07/14 07:36] sotoyama [基本的な使い方] |
プログラミング:python:pythonライブラリ:pillow:基本的な使い方 [2019/07/14 08:12] (現在) sotoyama [基本的な使い方] |
||
|---|---|---|---|
| ライン 5: | ライン 5: | ||
| from PIL import Image | from PIL import Image | ||
| - | img = Image.opend('D:\\develop\\python\\scraping\\sample.jpg') | + | img = Image.open(ファイルパス) |
| + | </code> | ||
| + | |||
| + | === 画像保存 === | ||
| + | <code python> | ||
| + | img = Image.open(ファイルパス) | ||
| + | img.save(ファイルパス) | ||
| + | </code> | ||
| + | |||
| + | === サイズ取得 === | ||
| + | <code python> | ||
| + | img = Image.open(ファイルパス) | ||
| + | print(img.size) | ||
| + | </code> | ||
| + | |||
| + | === リサイズ === | ||
| + | <code python> | ||
| + | img = Image.open(ファイルパス) | ||
| + | img = img.resize((1024, 768)) | ||
| </code> | </code> | ||