How to use _bbox_to_grim_region method in Pyscreenshot

Best Python code snippet using pyscreenshot_python

grim.py

Source:grim.py Github

copy

Full Screen

...10PROGRAM = "grim"11class GrimWrapper(CBackend):12 name = "grim"13 is_subprocess = True14 def _bbox_to_grim_region(self, bbox):15 """16 Translate pyscreenshot's bbox tuple convention of (x1, y1, x2, y2) to17 grim's bbox convention, which is a string of the following format:18 <x>,<y> <width>x<height>19 """20 x1, y1, x2, y2 = bbox21 width = x2 - x122 height = y2 - y123 return "{},{} {}x{}".format(x1, y1, width, height)24 def grab(self, bbox=None):25 if bbox:26 # using grim's built-in cropping feature27 region = self._bbox_to_grim_region(bbox)28 return read_prog_img([PROGRAM, "-g", region])29 return read_prog_img([PROGRAM])30 def backend_version(self):31 # grim doesn't have a version flag for some reason32 p = EasyProcess([PROGRAM, "-help"])33 p.enable_stdout_log = False34 p.enable_stderr_log = False35 p.call()36 if p.return_code == 0:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Pyscreenshot automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful