Search on blog:

Python: Jak zrobić zrzut ekranu z pyscreenshot

Nie wszystkie moduły, które robią zrzuty ekranu potrafią działać pod Linux.

Ten moduł działa na różnych systemach i może używać różnych programów.

Pod Linux może używać takich programów zewnętrznych jak scrot, gnome-screenshot, imagemagick

import pyscreenshot as ImageGrab

print(ImageGrab.backends())

# fullscreen
im = ImageGrab.grab(backend='scrot')

# to file
im.save('im.png')

# directly to file
ImageGrab.grab_to_file('im.png', backend='gnome-screenshot')

Lists wszystkich backendów: 'pil', 'mss', 'scrot', 'maim', 'imagemagick', 'qtpy', 'pyqt5', 'pyqt', 'pyside2', 'pyside', 'wx', 'pygdk3', 'pygtk', 'm ac_screencapture', 'mac_quartz', 'gnome_dbus', 'gnome-screenshot', 'kwin_dbus'

If you like it
Buy a Coffee