from PIL import Image, ImageEnhance
import pytesseract

path = '/root/.hermes/cache/images/img_668b1b2125b9.jpg'
img = Image.open(path)

# 放大2倍
img_large = img.resize((img.width * 2, img.height * 2), Image.LANCZOS)
enhancer = ImageEnhance.Contrast(img_large)
img_enhanced = enhancer.enhance(1.5)

# 快速OCR
text = pytesseract.image_to_string(img_enhanced, lang='chi_sim', config='--psm 6')
print(text.strip()[:3000])
