You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Both the image in docx and pdf will not be converted to base64 encoded content #58
Hello, I've found this repo and it is awesome to use this to convert some document to markdown. But when I use this tool to convert docx or pdf to markdown, the image in the file cannot be convertted currectly.
(venv) PS F:\Git\GamerNoTitle\Doc2Markdown> python
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from markitdown import MarkItDown
>>> handler = MarkItDown()
>>> docx_result = handler.convert(r"C:\Users\GamerNoTitle\Desktop\testdoc.docx")
>>> docx_result.text_content
'\n\n\n\nThe content above is a image.\n\n'
>>> pdf_result = handler.convert(r"C:\Users\GamerNoTitle\Desktop\testdoc.pdf")
>>> pdf_result.text_content
'The content above is a image.\n\n'
Better handling of images in documents is certainly something I would like to support, but just to be clear, what is your expected behavior here?
Should the images be saved to disk, and referenced in Markdown?
Should they be included inline as base64? (I would argue against this, since it makes the text unsuitable for a variety of downstream applications like indexing, or use in llms)
Should the images be sent through the same pipeline as .jpg etc, where we extract tags and other metadata?
My preference would be for the first option. Save to disk and reference in Markdown. I've been the issues base64 can cause and would suggest avoiding that one as well. Perhaps it could be a flag to toggle between extract or LLM pipeline?
Reacted by july_lu, Juan Diego López, damiansawko, Takumi Sugihara and Barun Saha
Better handling of images in documents is certainly something I would like to support, but just to be clear, what is your expected behavior here?
Should the images be saved to disk, and referenced in Markdown?
Should they be included inline as base64? (I would argue against this, since it makes the text unsuitable for a variety of downstream applications like indexing, or use in llms)
Should the images be sent through the same pipeline as .jpg etc, where we extract tags and other metadata?
I think it should be encoded as base64 format image, since this wheel is used to convert document to markdown, the images should be displayed correctly. Saving the image to file with reference is also acceptable. The final goal I think is to display the image correctly.
After all, thank you for all your work on this repo. It is really awesome to have such a tool to convert the document so easily.🎉
Reacted by Gagan Bansal, MarkyXP, Takumi Sugihara and letu
Activity
afourney commentedon Dec 16, 2024
Better handling of images in documents is certainly something I would like to support, but just to be clear, what is your expected behavior here?
zrh535 commentedon Dec 16, 2024
My preference would be for the first option. Save to disk and reference in Markdown. I've been the issues base64 can cause and would suggest avoiding that one as well. Perhaps it could be a flag to toggle between extract or LLM pipeline?
gagb commentedon Dec 17, 2024
Duplicate of #56
GamerNoTitle commentedon Dec 17, 2024
I think it should be encoded as base64 format image, since this wheel is used to convert document to markdown, the images should be displayed correctly. Saving the image to file with reference is also acceptable. The final goal I think is to display the image correctly.
After all, thank you for all your work on this repo. It is really awesome to have such a tool to convert the document so easily.🎉
MoonS11 commentedon Dec 19, 2024
How to read a DOCX file, the OCR of an image is recognized as text or image description
Gamecraft400 commentedon Dec 19, 2024
+1
afourney commentedon Mar 21, 2025
Fixed in #1140
akumar9-godaddy commentedon Sep 23, 2025
Adam Fourney (@afourney) / Yuzhong Zhang (@BetterAndBetterII) is this feature not supported for pdf ? I don't see anything related to image getting retained