A high-performance, standalone tool designed for Typora to automatically convert local images into Base64 strings when exporting HTML. This ensures your exported documents are single-file and portable, with no external image dependencies.
- π Zero Dependency: Built with Rust, compiles to a single static binary (~1.7MB). No .NET or Java runtime required.
- π¦ Smart Compression: Automatically compresses PNG/JPG images to WebP format (Quality 75) to significantly reduce HTML file size (often by 40-60%).
- π Smart Path Resolution: accurately finds images even if Typora doesn't copy
assetsfolder (checks both HTML export location and original Source file location). - π Encoding Support: Auto-detects UTF-8 and GBK/Chinese encodings to prevent file corruption.
- Scan: Reads the HTML file and uses Regex to locate image tags (supports both HTML
<img src>and Markdown![]()syntax). - Dual Search Strategy:
- Primary: Looks for the image relative to the exported HTML file.
- Fallback: If not found, it intelligently checks the original Typora source directory (CWD). This ensures images are found even if the
assetsfolder wasn't exported.
- Smart Conversion:
- Compression: Static images (PNG/JPG/BMP) are re-encoded to WebP to save space.
- Pass-through: Animated GIFs and SVGs are encoded as-is to preserve animation and vector quality.
- Embed: Replaces the image link in the HTML with the generated Base64 data string.
- Safety: The tool is Read-Only for your image files. It never modifies or deletes your source images.
If you have Rust installed:
cargo build --releaseThe executable will be at target/release/TyporaToBase64RS.exe.
-
Open Typora.
-
Go to File -> Preferences -> Export.
-
Select HTML in the list.
-
In the "Run Command" (or Post-Export Hooks) section, enter:
"path\to\TyporaToBase64RS.exe" "${outputPath}"
Make sure to keep the double quotes around the path.
Now, whenever you export to HTML, this tool will automatically run, convert your images, and you will get a fully self-contained HTML file.
MIT