Search code examples
python-3.xcross-platformscreenshot

Cross-platform screenshot in Python 3


There are quite a few questions like this one, but none of them seem to be both cross-platform and specifically for Python 3, and I'm struggling to find a reliable solution.

How can I take a cross-platform screenshot in Python 3?


Solution

  • My current solution has been to use the ImageGrab function from the PIL library, like so:

    from PIL import ImageGrab
    image = ImageGrab.grab()