Generate HTML file from (exported?) image/video

Addon is located in Import-Export section.
Known working Blender versions are 2.93 and up, but it should likely work fine with anything 2.8 and higher.
This addon shoves images or videos inside an HTML file itself via Base64 encoding. In a way, you can think of this as exporting to HTML with extra steps. You can throw the HTML file around anywhere without having to bundle it with separate files or you can edit it yourself and copy the relevant tags or whatever else you want, I don’t know.

  1. Export your images as you would normally in PNG or JPEG* format with your favorite compression settings and whatnot, or videos in WEBM
  2. Run the addon’s operator from the Misc tab in the N-menu in the 3D viewport or the Image editor, or via F3 > Generate/Export HTML file
  3. Select your files from step 1, or any files really
    3.5 optional: Pick a name, flavor text and add attributes to the tags
  4. Enjoy your HTML file with everything embedded inside it

The addon will likely not work if you try to write in a area you don’t have permissions for or if you try to tell it to use forbidden characters in the filename, so don’t do those things.
*Works fine with JFIF too, but apparently Blender doesn’t display JFIF previews so keep that in mind. Which is the right thing for Blender, no one sane should ever put “JFIF” at the end of their file.

-L0Lock- on rightclickselect tipped me off that putting an image in HTML directly is possible so I decided to make an addon for it. Enjoy “exporting” to HTML. Tell me if there’s any big pressing issues or other necessities.

io_export_html_base64_0_2_0.py (8.0 KB)

Old version and changelog
Changelogs

0.1 → 0.2:

  • Added support for video and multiple files at once
  • Added option to omit unsupported files rather than filtering to only show supported ones
  • Structured HTML to be a bit more easily editable
  • Added option to add attributes to the tags
  • Added flavor text option to keep file extensions

io_export_html_base64_0_1_0.py (5.1 KB)

1 Like