python-mss icon indicating copy to clipboard operation
python-mss copied to clipboard

Feature(?): Grab only app's frame

Open mnfro opened this issue 5 years ago • 3 comments

General information:

  • OS name: macOS Catalina
  • OS version: 10.15.4
  • Python version: 3.7.7
  • MSS version: last

Description

Is there a way to capture only the frame of a specific app window? I mean with built-in macOS screencapture, I can do something like this to get a screenshot of a particular app:

os.system("screencapture {options} -l {window} {filename}")

where {window} represents the windowID of the app, in my case QuickTime Player app ID (obtained from Quartz).

Being able to specify which app I want to take the screenshot of would result in a more flexibility, as I can move the app window wherever I want and I don't need to set any kind of boundary (top,left,width,height).

cheers, mate!

mnfro avatar Apr 27 '20 14:04 mnfro

Hey,

Yes, it would be cool to have it! Another thing on my TODO list ;)

BoboTiG avatar Apr 27 '20 14:04 BoboTiG

You can write a while-loop, which gets the rectangle of the app via his PID - this rectangle you can set as argument on the mss.grab function.

xXSkyWalkerXx1 avatar Jun 09 '20 21:06 xXSkyWalkerXx1

I just wrote a solution for this request here #180 and it is indeed possible. I am currently attempting to edit this library to provide the function, but I am not sure how far I will progress on my own :P

BanditTech avatar Aug 13 '20 04:08 BanditTech