Open seiyria opened 5 years ago
This can be supported, methods to do so would need to be investigated for each operating system. I don't have any need individual windows myself, thus won't be developing the feature however very open to a pull request adding support!
For Windows there's a function already existing in the .bat
script used.
I propose that be used with an interface along the lines of:
const windows = await screenshot.listWindows()
const firstWindowImage = await screenshot({ windowId: windows[0].id })
const minecraftImage = await screenshot({ windowTitle: 'Minecraft' })
I think your interface makes sense. My concern with the windowTitle
example is - what if you have multiple windows? I think it would make sense to return an array of images in this case, and get them all.
I implemented this using C#/edge here: https://github.com/seiyria/rectshot and in my module my solution was to iterate over the windows and take pictures of each of them.
This is true, another alternative would be to only accept ids and not titles so a user must come up with their own logic if they wanted title targetting.
I'm not sure that's a good idea. The average dev will not know how to get window ids nor should they be expected to be. Unless ListWindows will return something that allows for filtering, I would just make screenshot always return an array.
Perhaps this might interest someone: I wanted to narrow the image down to the specific area where the user was typing at the time, not the entire window. Since I am running under Electron I run an AHK script via Electron's child_process
to get the caret position (this is not always available - in that case I use the mouse position via Electron's getCursorScreenPoint()
) and I then use jimp to crop the screenshot-desktop
image to an even square from the caret/mouse position for about 15% of the screen size in each direction. In my case I then pass the cropped (and grey-scaled) image to Tesseract-OCR and the results are excellent.
Hi guys,
Has there been any progress with this feature?
Can't say I've delved into it at all but a PR adding the functionality would be very welcome!
On Wed, 5 Aug 2020, 10:58 Pavlos Polianidis, notifications@github.com wrote:
Hi guys,
Has there been any progress with this feature?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bencevans/screenshot-desktop/issues/121#issuecomment-669101640, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE34RZ4Z3POZ3RJJVPOVA3R7EUNPANCNFSM4GSOUX2Q .
I would like to use a handler to grab a particular window and screenshot that. it doesn't seem to be possible yet, but is this something that can be easily supported?