Make I38's ocr compatible with older versions of pillow.
This commit is contained in:
+3
-1
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user