def scan(self, bbox=None, rough=True): # ImageGrab.grab currently doesn't support multiple monitors. # If PIL gets updated with multimon support, this can be switched back. img = gdi.grab_screen(bbox) # ImageGrab.grab(bbox) if rough: factor = settings.SETTINGS["miscellaneous"][ "legion_downscale_factor"] if str(factor) == "auto": # Choose a fixed "rough" final size that will work in most circumstances factor = min(1500 / float(img.size[0]), 1) new_size = (img.size[0] * factor, img.size[1] * factor) img.thumbnail(new_size) img = img.filter(ImageFilter.FIND_EDGES) result = self.tirg_scan(img) if rough: result = result.split(",") result = list(filter(None, result)) # Removes empty items result = [int(float(i) / factor) for i in result] result = ",".join(str(bit) for bit in result) if result != self.last_signature: with self.lock: self.last_signature = result self.screen_has_changed = True
def scan(self, bbox=None): # ImageGrab.grab currently doesn't support multiple monitors. # If PIL gets updated with multimon support, this can be switched back. img = gdi.grab_screen(bbox) # ImageGrab.grab(bbox) img = img.filter(ImageFilter.FIND_EDGES) result = self.tirg_scan(img) if result != self.last_signature: with self.lock: self.last_signature = result self.screen_has_changed = True