1
0

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 1 year has passed since last update.

クリップボードからのイメージ取得

Posted at

クリップボードからのイメージ取得

Pythonでクリップボードからイメージを取得するコードを紹介します。

pillow のインストール

pillow をインストールします。

pip install pillow

クリップボードからのイメージ取得コード

from PIL import ImageGrab, Image

def main_logic():
    clip_img = ImageGrab.grabclipboard()
    print(clip_img)
    if isinstance(clip_img,Image.Image):
        print("this is image.")
        clip_img.save("c:/tmp/clipboard.png")
    else:
        print("this is not image.")

if __name__ == '__main__':
    main_logic()

👇参考URL

クリップボードからのイメージ取得

更新日:2023/03/12

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?