Skip to content

Instantly share code, notes, and snippets.

View Kodiologist's full-sized avatar

Kodi Arfer Kodiologist

View GitHub Profile
@Kodiologist
Kodiologist / embedder.py
Last active June 12, 2019 15:54 — forked from Matjaz-B/embedder.py
Embed images into an HTML document with data URIs
#!/usr/bin/env python3
"""
Embed images into an HTML document
"""
import base64, mimetypes, re, sys
## from https://gist.github.com/jsocol/1089733
def img_to_data(path):
"""Convert a file (specified by a path) into a data URI."""