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

Capture single window #194

Open
stuaxo opened this issue Oct 19, 2020 · 7 comments
Open

Capture single window #194

stuaxo opened this issue Oct 19, 2020 · 7 comments

Comments

@stuaxo
Copy link

stuaxo commented Oct 19, 2020

There should be options to capture single windows.

There is complication here, as different strategies may not work in even within a single OS.

IMO where possible capture should not capture the whole screen clipped to the window, where possible it should use native APIs to grab just the window.

On windows, one example of this is here
https://stackoverflow.com/questions/19695214/python-screenshot-of-inactive-window-printwindow-win32gui

It doesn't work for Modern UI apps, (so calculator does not work, but notepad does), where different APIs are needed, but it's probably better than nothing / a start ?

@sagarreddypatil
Copy link

Not a dev here but here I have an idea on how this could be done.

  • On Linux, use an interface for X11
  • On Windows, use Win32GUI API
  • On Mac, could use appscript

Find the Window size and position with the API, and use that as the mask for the screen capture.

@stuaxo
Copy link
Author

stuaxo commented Oct 22, 2020

This can definitely be done.

I'm arguing against a mask + fullscreen capture where possible so that windows don't need to be moved to the front to be captured.

@salonsoGH
Copy link

Is it possible to capture a single app window on OSX?

@stuaxo
Copy link
Author

stuaxo commented Nov 6, 2020

Looks like it https://stackoverflow.com/a/48030215

@salonsoGH
Copy link

I meant, with this library using python.

@stuaxo
Copy link
Author

stuaxo commented Nov 8, 2020

No, that is what this issue is to request.

There is another project called screenshot that you can use for that.

@archiif
Copy link

archiif commented May 11, 2021

Here's a Windows implementation of this feature from flexx (purely with ctypes):
https://github.com/flexxui/flexx/blob/master/flexx/util/screenshot.py
Though the comment says that it supports Linux, it seems that only the Windows part is implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants