Skip to content

Commit

Permalink
Enlarge screenshot image to get more precious text
Browse files Browse the repository at this point in the history
Signed-off-by: Qi Zhang <[email protected]>
  • Loading branch information
keirazhang committed Jan 5, 2024
1 parent 4f0e40d commit ed4250f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ def escape_ansi(text):
def extract_text_from_image(image_path):
# Open the image file
img = Image.open(image_path)

if (img.width <= 1280 or img.height <= 1280):
(width, height) = (img.width * 3, img.height * 3)
else:
(width, height) = (img.width, img.height)
img = img.resize((width, height))
# Use pytesseract to do OCR on the image
text = pytesseract.image_to_string(img)
text = remove_empty_lines(text)
Expand Down

0 comments on commit ed4250f

Please sign in to comment.