Skip to content

fix: use grab/grabRegion for screenshots#11

Merged
jairad26 merged 1 commit intodevfrom
fix/desktop-screenshot-grab
Mar 31, 2026
Merged

fix: use grab/grabRegion for screenshots#11
jairad26 merged 1 commit intodevfrom
fix/desktop-screenshot-grab

Conversation

@jairad26
Copy link
Copy Markdown
Owner

Fixes ENOENT error when taking screenshots.

The screen.capture() methods return the actual saved path, not write to the path we pass. Using grab()/grabRegion() with toPNG() gets the buffer directly without temp file issues.

The screen.capture() and captureRegion() methods don't write to the
path we expect - they return the actual saved path. The code was trying
to read from a temp file path that never had the screenshot data.

Fix: Use grab()/grabRegion() which return Image objects, then call
toPNG() to get the buffer directly. This eliminates temp file issues.

Also removes unused imports (os, fs/promises) and tempFile() function.
@jairad26 jairad26 merged commit f13efcd into dev Mar 31, 2026
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

Successfully merging this pull request may close these issues.

1 participant