octalmage / robotjs

Node.js Desktop Automation.
http://robotjs.io
MIT License
12.37k stars 961 forks source link

Segmentation Fault 11 when triggering screen.capture (MacOS) #607

Closed MiloAkerman closed 4 years ago

MiloAkerman commented 4 years ago

Code:

//SCHEIGHT and SCWIDTH are variables
var img = robot.screen.capture(SCWIDTH[0] - 10, SCHEIGHT[0] - 10, SCWIDTH[1] + 10, SCHEIGHT[1] + 10);

Expected Behavior

Screenshot should be taken, and img should return a bitmap.

Current Behavior

Terminal gives me Segmentation fault: 11 error

Possible Solution

  1. Switch to Windows. I have a partition, but I'd rather be able to do this from my Mac
  2. Give Screen Sharing permissions to Terminal (Whose prompt I can't seem to trigger even after taking the nuclear option and clearing every permission)

Steps to Reproduce (for bugs)

  1. Use MacOS
  2. Create a JS file
  3. Install Robot
  4. Run robot.screen.capture()

Context

I'm trying to take a screenshot and filter through each color for a specific HEX value, however, I can't take a screenshot to look through. I've tried getPixelAt() bu it's extremely slow for what i'm trying to accomplish.

Your Environment

MiloAkerman commented 4 years ago

Solved! I was trying to take a screenshot starting from -10 while using a single monitor.