24 lines
649 B
Python
24 lines
649 B
Python
import sys
|
|
import io
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
|
|
|
from PIL import Image
|
|
|
|
img = Image.open(r"D:\Yuzu-GCA\screen2.png")
|
|
print(f"Format: {img.format}, Size: {img.size}, Mode: {img.mode}")
|
|
|
|
# Try pytesseract OCR
|
|
try:
|
|
import pytesseract
|
|
|
|
# Configure tesseract path if needed
|
|
# pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
|
|
|
|
text = pytesseract.image_to_string(img, lang='chi_sim+eng')
|
|
print("\n=== OCR Result ===")
|
|
print(text)
|
|
except ImportError:
|
|
print("\npytesseract not available")
|
|
except Exception as e:
|
|
print(f"\nOCR error: {e}")
|