You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
476 B
19 lines
476 B
#!/usr/bin/env python3
|
|
import pytesseract
|
|
from PIL import Image
|
|
import sys
|
|
|
|
# 读取图片
|
|
img_path = sys.argv[1] if len(sys.argv) > 1 else '/root/.openclaw/media/inbound/1274bb78-c104-4ce6-88e4-a725848fda91.jpg'
|
|
|
|
try:
|
|
img = Image.open(img_path)
|
|
print("成功加载图片")
|
|
|
|
# 提取英文
|
|
text_eng = pytesseract.image_to_string(img, lang='eng')
|
|
print("\n=== 英文原文 ===")
|
|
print(text_eng)
|
|
|
|
except Exception as e:
|
|
print(f"错误: {e}")
|
|
|