From ebe9cdb4e0ece83088ef56c500eccbf80c657641 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 27 Jul 2026 18:45:40 -0400 Subject: [PATCH] Make I38's ocr compatible with older versions of pillow. --- scripts/ocr.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ocr.py b/scripts/ocr.py index ce91ab0..5627bd0 100755 --- a/scripts/ocr.py +++ b/scripts/ocr.py @@ -25,6 +25,8 @@ from PIL import Image, ImageOps import pytesseract import pyperclip +bicubicResampleFilter = getattr(Image, "Resampling", Image).BICUBIC + def capture_screen(max_retries=3, initial_delay=0.2): """ Capture the screen using scrot with robust checking and retries @@ -84,7 +86,7 @@ def process_image(img, scale_factor=1.5): if scale_factor != 1: width, height = img.size img = img.resize((int(width * scale_factor), int(height * scale_factor)), - Image.Resampling.BICUBIC) + bicubicResampleFilter) # Convert to grayscale for faster processing img = ImageOps.grayscale(img)