Giter Site home page Giter Site logo

md-image-extractor's Introduction

Markdown Image Extractor

This repository contains a Python script that extracts base64 embedded images from a markdown file, saves them to disk as binary images, and outputs a modified version of the markdown file with references to the new image files.

The script supports output with both the standard markdown image embed format (!(alt text)[filename.png]) and with Obsidian's markdown image embed format (![[image_name.png]])

Usage

This project requires Python 3.8 or above.

The script can be run from the command line with the following arguments:

  • input_filename: The name of the input markdown file
  • --output_dir: The destination folder for output (defaults to "output")
  • --image_prefix: Prefix for image filenames (e.g. the "image_" portion of "image_0.png", "image_1.png", etc.)
  • --obsidian_format: Outputs the image embed code in Obsidian format: ![[image_name.png]]

Example usage:

python main.py input.md --output_dir output --image_prefix image_ --obsidian_format

This will process the input.md file, save the extracted images to the output directory with filenames starting with image_, and output a modified version of the input.md file with image references in Obsidian format.

License

This project is licensed under the terms of the MIT license.

md-image-extractor's People

Contributors

machinebiologist avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

bradleybooth

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.