1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Python][Windows]画面のスクリーンショットを画像として保存する

Last updated at Posted at 2020-10-30

###初めに
拡張画面のスクリーンショットを保存する必要が出てきたためシンプルに書いてみました。

###方針
1.スクショと言えばPrtScキー押し(PyAutoGUI)
2.クリップボードの内容を保存(PIL)

prtsc.py
import pyautogui
from PIL import ImageGrab

# 保存したい場所とファイル名を指定
fo = r"C:\Users\hoge\Pictures\Screenshots\desktop.png"

pyautogui.press('printscreen')

im = ImageGrab.grabclipboard()
im.save(fo)

###補足

使用モジュールPyAutoGUIとPILのインストールはググってください。
覚えてないです・・・

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?