diff --git a/src/markitdown/_markitdown.py b/src/markitdown/_markitdown.py index 96997cf..332b2d1 100644 --- a/src/markitdown/_markitdown.py +++ b/src/markitdown/_markitdown.py @@ -798,6 +798,20 @@ class ImageConverter(MediaConverter): ).strip() + "\n" ) + # add ocr only when MLM is not available + if mlm_client is None or mlm_model is None: + try: + import easyocr + reader = easyocr.Reader(['ch_sim','en']) # support chinese and english + ocr_result = reader.readtext(local_path) + if ocr_result: + md_content += "\n" + for detection in ocr_result: + text = detection[1] # extract text + md_content += f"- {text}\n" + except ImportError: + # easyocr not installed + pass return DocumentConverterResult( title=None,