teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

修正

2020/04/07 09:07

投稿

tiitoi
tiitoi

スコア21960

answer CHANGED
@@ -3,4 +3,22 @@
3
3
 
4
4
  [[Python][Windows] Pythonでスクリーンキャプチャを行う - Qiita](https://qiita.com/koara-local/items/6a98298d793f22cf2e36)
5
5
 
6
- [ImageGrab Module (OS X and Windows only) — Pillow (PIL Fork) 3.0.0 documentation](https://pillow.readthedocs.io/en/3.0.x/reference/ImageGrab.html)
6
+ [ImageGrab Module (OS X and Windows only) — Pillow (PIL Fork) 3.0.0 documentation](https://pillow.readthedocs.io/en/3.0.x/reference/ImageGrab.html)
7
+
8
+ ## 追記
9
+
10
+ > 修正しましたがエラーは直りませんでした
11
+
12
+ どのように修正したのでしょうか。
13
+ 以下のコードで Windows 環境、Pillow 4.0.0 でスクリーンショットを取得できることを確認しました。
14
+
15
+ ```python
16
+ from PIL import ImageGrab
17
+
18
+ # スクリーンショットを取得する
19
+ img = ImageGrab.grab()
20
+
21
+ # 送信するなら Image オブジェクトをバイト列にする
22
+ binary = img.tobytes()
23
+ print(len(binary))
24
+ ```