MCPcopy Create free account
hub / github.com/T-duality/PillOCR-python / process_clipboard_image

Method process_clipboard_image

GPTOCRGUI.py:144–169  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

142 return self.markdown_processor.modify_wrappers(markdown_content)
143
144 def process_clipboard_image(self):
145 if not self.process_pre_exist_image:
146 last_image=self.initial_image
147 else:
148 last_image = None
149 while self.running:
150 try:
151 if self.screenshot_hotkey_isNull or self.screenshot_hotkey_triggered:
152 image = ImageGrab.grabclipboard()
153 if isinstance(image, Image.Image) and image != last_image:
154 self.log_callback("检测到新的剪贴板图像。")
155 self.app.update_icon_status('processing')
156
157 markdown_content = self.process_image(image)
158 pyperclip.copy(markdown_content)
159 self.log_callback("识别后的内容已复制到剪贴板。")
160
161 self.app.update_icon_status('success')
162 last_image = image
163 self.screenshot_hotkey_triggered = False
164 except Exception as e:
165 self.log_callback(f"发生错误: {e}")
166 self.app.update_icon_status('error')
167 self.running = False
168 break
169 time.sleep(1)
170
171 def start(self):
172 self.running = True

Callers

nothing calls this directly

Calls 2

process_imageMethod · 0.95
update_icon_statusMethod · 0.80

Tested by

no test coverage detected