Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImageGrab.grab() for Linux with XCB #4260

Merged
merged 9 commits into from Mar 31, 2020
Merged

Conversation

nulano
Copy link
Contributor

@nulano nulano commented Dec 9, 2019

Partially resolves #2028

Alternative to #4198

Changes proposed in this pull request:

  • Add ImageGrab.grab() support for X11 (Linux) using the XCB library (only screenshots for now, clipboard can be added in the future)

There is also support for taking X11 screenshots on Windows and macOS (where X11 can be installed as a separate window manager). This proposed implementation uses the old methods if xdisplay=None is passed, but if xdisplay="" is passed (or on Linux), it will grab the default X11 screen (likely from the DISPLAY envvar). A different value can be passed in the xdisplay parameter to override the default X11 screen address.

Unlike mss which uses Xlib, this uses XCB. This provides more resilient error handling at the cost of potentially slightly lower OS compatibility (Xlib is older).

@radarhere radarhere changed the title Imagegrab.grab() for Linux with XCB ImageGrab.grab() for Linux with XCB Dec 28, 2019
src/PIL/ImageGrab.py Outdated Show resolved Hide resolved
@python-pillow python-pillow deleted a comment from codecov bot Jan 27, 2020
@python-pillow python-pillow deleted a comment from codecov bot Jan 27, 2020
@python-pillow python-pillow deleted a comment from codecov bot Jan 27, 2020
@python-pillow python-pillow deleted a comment from codecov bot Feb 15, 2020
@python-pillow python-pillow deleted a comment from codecov bot Feb 15, 2020
@radarhere radarhere force-pushed the imagegrab_xcb branch 2 times, most recently from 7adf9df to ed56fa6 Compare February 23, 2020 04:01
@python-pillow python-pillow deleted a comment from codecov bot Feb 23, 2020
@python-pillow python-pillow deleted a comment from codecov bot Feb 23, 2020
@python-pillow python-pillow deleted a comment from codecov bot Mar 9, 2020
@radarhere radarhere force-pushed the imagegrab_xcb branch 2 times, most recently from c48bc1b to 87ab384 Compare March 11, 2020 11:53
@python-pillow python-pillow deleted a comment from codecov bot Mar 11, 2020
This was referenced Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImageGrab on Linux
3 participants