diff -Naur byzanz-orig/data/Makefile.am byzanz/data/Makefile.am
--- byzanz-orig/data/Makefile.am	2006-01-18 17:04:02.000000000 +0100
+++ byzanz/data/Makefile.am	2006-03-05 13:31:09.000000000 +0100
@@ -6,4 +6,7 @@
 	byzanz-record-screen.png \
 	byzanz-record-window.png
 
-EXTRA_DIST = $(icons_DATA)
+templatesdir = $(datadir)/byzanz
+templates_DATA = template.html
+
+EXTRA_DIST = $(icons_DATA) $(templates_DATA)
diff -Naur byzanz-orig/data/template.html byzanz/data/template.html
--- byzanz-orig/data/template.html	1970-01-01 01:00:00.000000000 +0100
+++ byzanz/data/template.html	2006-03-05 13:30:30.000000000 +0100
@@ -0,0 +1,16 @@
+<html>
+ <head>
+  <title>Screencast</title>
+  <style type="text/css">
+html, body {
+	margin: 0;
+}
+  </style>
+ </head>
+ <body>
+
+  <img src="%s" alt="" />
+
+ </body>
+</html>
+
diff -Naur byzanz-orig/src/byzanzapplet.c byzanz/src/byzanzapplet.c
--- byzanz-orig/src/byzanzapplet.c	2006-02-12 07:27:04.000000000 +0100
+++ byzanz/src/byzanzapplet.c	2006-03-05 13:44:56.000000000 +0100
@@ -136,10 +136,12 @@
   GList *src, *target;
   GnomeVFSURI *src_uri;
 
-  if (byzanz_recorder_is_active (pending->rec))
-    return TRUE;
-  byzanz_recorder_destroy (pending->rec);
-  pending->rec = NULL;
+  if (pending->rec) {
+    if (byzanz_recorder_is_active (pending->rec))
+      return TRUE;
+    byzanz_recorder_destroy (pending->rec);
+    pending->rec = NULL;
+  }
 
   if (pending->target == NULL) {
     pending_recording_destroy (pending);
@@ -164,7 +166,7 @@
 static void
 pending_recording_launch (AppletPrivate *priv, ByzanzRecorder *rec, char *tmp_file)
 {
-  PendingRecording *pending;
+  PendingRecording *pending, *pending_html = NULL;
   GtkWidget *dialog;
   char *start_dir, *end_dir;
   
@@ -187,7 +189,46 @@
   gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
   if (GTK_RESPONSE_ACCEPT == gtk_dialog_run (GTK_DIALOG (dialog))) {
     char *target_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
-    pending->target = gnome_vfs_uri_new (target_uri);
+    if (g_str_has_suffix(target_uri, ".html")) {
+      char *gif_uri;
+      char *gif_filename;
+      int fd;
+      char *html_tmp_name;
+      char *html_template;
+      gchar *buf_tmpl, *buf;
+
+      gif_uri = g_strdup(target_uri);
+      strcpy(gif_uri+strlen(gif_uri)-4, "gif");
+      pending->target = gnome_vfs_uri_new (gif_uri);
+
+      if ((fd = g_file_open_tmp("byzanz_XXXXXX", &html_tmp_name, NULL)) != -1) {
+        html_template = panel_applet_gconf_get_string (priv->applet, "html_template", NULL);
+	if (html_template == NULL || html_template[0] == '\0') {
+	  html_template = g_strdup(DATADIR "/byzanz/template.html");
+	}
+	if (html_template) {
+	  if (g_file_get_contents(html_template, &buf_tmpl, NULL, NULL) == FALSE) {
+	    /* default to the most basic template */
+            buf_tmpl = g_strdup("<html><body><img src=\"%s\" /></body></html>");
+	  }
+	}
+        gif_filename = g_path_get_basename(gnome_vfs_uri_get_path(pending->target));
+	buf = g_strdup_printf(buf_tmpl, gif_filename);
+        write(fd, buf, strlen(buf));
+	g_free(html_template);
+        g_free(gif_filename);
+	g_free(buf_tmpl);
+        g_free(buf);
+        close(fd);
+
+        pending_html = g_new0 (PendingRecording, 1);
+        pending_html->tmp_file = html_tmp_name;
+        pending_html->target = gnome_vfs_uri_new (target_uri);
+      }
+  
+    } else {
+      pending->target = gnome_vfs_uri_new (target_uri);
+    }
     end_dir = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (dialog));
     if (end_dir && 
 	(!start_dir || !g_str_equal (end_dir, start_dir))) {
@@ -198,6 +239,9 @@
   g_free (start_dir);
   gtk_widget_destroy (dialog);
   g_timeout_add (1000, check_done_saving_cb, pending);
+  if (pending_html) {
+    g_timeout_add (1000, check_done_saving_cb, pending_html);
+  }
   gtk_main ();
   return;
 }
diff -Naur byzanz-orig/src/byzanz.schemas.in byzanz/src/byzanz.schemas.in
--- byzanz-orig/src/byzanz.schemas.in	2006-01-23 13:20:38.000000000 +0100
+++ byzanz/src/byzanz.schemas.in	2006-03-05 13:37:37.000000000 +0100
@@ -34,5 +34,16 @@
 	</locale>
       </schema>
 
+      <schema>
+        <key>/schemas/apps/byzanz-applet/prefs/html_template</key>
+	<owner>byzanz-applet</owner>
+	<type>string</type>
+	<default></default>
+	<locale name="C">
+	  <short>Filename of HTML Template</short>
+	  <long>When saving as HTML, use this file contents as template.</long>
+	</locale>
+      </schema>
+
   </schemalist>
 </gconfschemafile>
