Skip to content

how to save image in the markdown #162

Closed

Description

The image in the markdown is represented as this: . How can I save images?

Activity

  1. Misnad commented on Dec 21, 2024

    @Misnad

    Can you show an example?

  2. charliedream1 commented on Dec 24, 2024

    @charliedream1
    Author
    from markitdown import MarkItDown
    
    md = MarkItDown()
    result = md.convert("test.pdf")
    print(result.text_content)
    
    md_file = 'text.md'
    with open(md_file, 'w') as f:
           f.write(result.text_content)

    I'm write code like this. In file text.md, only text saved, the image part shows like [](.data/image:base64...), I couldn't find this figure.

    • How to get this base64 image directly from function md.convert("test.xlsx")?
    • How to save images?
  3. corolair-hazem commented on Dec 24, 2024

    @corolair-hazem

    up

  4. infogulch commented on Jan 2, 2025

    @infogulch

    I have documents with embedded images that I would like to convert to markdown, so this feature would be helpful for me.

    Currently when exporting it exports like this (exact quote):

    ![LABEL - TMG.jpg](data:image/jpeg;base64...)
    

    I could see two resolutions:

    1. Complete the embedded image data ![](data:image/png;base64...). I think this would work display correctly when rendering markdown.
    2. Add an option to export embedded images as files in a particular directory and create relative links to them.
  5. oliviermills commented on Jan 6, 2025

    @oliviermills

    Same problem, base64 data shoul be in the data-url or file saved, neither are there.. just ![](data:image/png;base64...) ie.. "..." were the base64 image data should be

  6. tjyangsg commented on Jan 17, 2025

    @tjyangsg

    Same problem. I convert word to md, all the image embedded in the document convert to just ![](data:image/png;base64...)

  7. SnakeHacker commented on Feb 17, 2025

    @SnakeHacker

    Refer to issues51

    Modify the file packages/markitdown/src/markitdown/converters/_markdownify.py, comment out the following code.

    # if src.startswith("data:"):
    #     src = src.split(",")[0] + "..."
    
    Image

    Reinstall it and you're done.

    pip install -e packages/markitdown
    

    Now it works!

  8. tjyangsg commented on Feb 17, 2025

    @tjyangsg
  9. charliedream1 commented on Feb 17, 2025

    @charliedream1
    Author
  10. SnakeHacker commented on Feb 17, 2025

    @SnakeHacker

    What's the meaning of view on web? image can't be visit ed locally?
    …

    This is merely a matter of omission, as the new version aims to conserve tokens for llm.

  11. charliedream1 commented on Feb 17, 2025

    @charliedream1
    Author
  12. afourney commented on Mar 21, 2025

    @afourney
    Member

    Base 64 images are now optionally maintained (in #1140)

  13. tjyangsg commented on Mar 21, 2025

    @tjyangsg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions