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

How to capture a single window, not the full screen #81

Open
random-developer opened this issue Aug 20, 2021 · 0 comments
Open

How to capture a single window, not the full screen #81

random-developer opened this issue Aug 20, 2021 · 0 comments

Comments

@random-developer
Copy link

Is autopy able to capture the image of a single window? Alternatively, is there a way to tell autopy.bitmap a height/width/set of bits to have it build a bitmap (without needing to go through the file system)?

For context, on macOS you can get a CGImage of just a specific window if you know its window Id:

from Quartz import CGWindowListCreateImage, CGRectNull, kCGWindowListOptionIncludingWindow, kCGWindowImageBoundsIgnoreFraming, kCGWindowImageNominalResolution
def imageOfWindow(windowId):
    return CGWindowListCreateImage(CGRectNull, kCGWindowListOptionIncludingWindow, windowId, kCGWindowImageBoundsIgnoreFraming|kCGWindowImageNominalResolution)

and it would be nice to be able to use autopy's bitmap searching on that. From the CGImageRef I could write the image to a png file and then read it into autopy but that's wasteful.

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

No branches or pull requests

1 participant