BUGFIX: image processing only handles filenames with jpg
This commit is contained in:
parent
e96f23ddc8
commit
963d99404e
|
@ -44,7 +44,11 @@ def convert_image(image_path):
|
|||
|
||||
def ocr_image(image_path):
|
||||
logging.info(f"OCR'ing {image_path}...")
|
||||
text_filename = os.path.basename(image_path).replace(".jpg", ".txt")
|
||||
|
||||
base_name = os.path.basename(image_path)
|
||||
root_name, _ = os.path.splitext(base_name)
|
||||
text_filename = f"{root_name}.txt"
|
||||
|
||||
text_path = os.path.join(CONVERTED_DIR, text_filename)
|
||||
cmd = ["tesseract", image_path, text_path.replace(".txt", "")]
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user