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)