Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6060

Troubleshooting • Invalid geometry using grim

$
0
0
Hi,

Trying to take a screenshot using grim inside a Python script using subprocess but I am getting an invalid geometry error. This is running on a headless setup, here's the applicable part of my code

Code:

    grim_region = f"{x},{y}, {w}x{h}"    ss_data = subprocess.check_output(["grim", "-g", grim_region, "-t", "ppm", "-"])
And the extended error:

Code:

File "/usr/lib/python3.11/subprocess.py", line 571, in run    raise CalledProcessError(retcode, process.args,subprocess.CalledProcessError: Command '['grim', '-g', '1605,296, 85x24', '-t', 'ppm', '-']' returned non-zero exit status 1.
Any ideas on what I've done wrong?

Also, my end goal is to take a screenshot at regular intervals and process it though tesseract. I'm not even sure if this is possible on a headless Pi, as I won't be VNCd into it all of the time? I'm thinking there's no screen so nothing to screenshot?

Statistics: Posted by FISTPI — Mon Mar 10, 2025 5:47 pm — Replies 1 — Views 61



Viewing all articles
Browse latest Browse all 6060

Trending Articles