Skip to content

Instantly share code, notes, and snippets.

View keithcallenberg's full-sized avatar

Keith Callenberg keithcallenberg

View GitHub Profile
@keithcallenberg
keithcallenberg / standalone_html.py
Last active January 18, 2022 16:03 — forked from pansapiens/standalone_html.py
Convert HTML to a self contained file with inline Base64 encoded PNG images
#!/usr/bin/env python
# A simple script to suck up HTML, convert any images to inline Base64
# encoded format and write out the converted file.
#
# Usage: python standalone_html.py <input_file.html> <output_file.html>
#
# TODO: Consider MHTML format: https://en.wikipedia.org/wiki/MHTML
import os
from bs4 import BeautifulSoup