1
5

More than 3 years have passed since last update.

Python PyAutoGUIを使ってスクリーンショット

Posted at

Python PyAutoGUIを使ってスクリーンショット

PyAutoGUIをインストール

pip install pyautogui

スクリーンショット

import pyautogui


def main():
    # 全体
    screenshot = pyautogui.screenshot()
    screenshot.save("/tmp/samp1.png")
  
    # 範囲指定
    screenshot = pyautogui.screenshot(region=(100, 200, 1500, 875))
    screenshot.save("/tmp/samp2.png")


if __name__ == "__main__":
    main()

結果

全体
samp1.png
範囲指定
samp2.png


いいね!と思ったら LGTM お願いします :clap::clap::clap:

【PR】プログラミング新聞リリースしました! → https://pronichi.com
【PR】週末ハッカソンというイベントやってます! → https://weekend-hackathon.toyscreation.jp/about/

1
5
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
5