FW: This code performs the rather esoteric function of converting an image file to a raw HTML page, using <table> tags with a cell for each pixel. The output is, of course, huge, and will crash some older browsers or systems. The only use I can think of this is if you had a hosting service which had tons of bandwidth but didn't support images, and really needed one.
proc htmlize {image_file save_to} { set page [open $save_to w] set source [image create photo -file $image_file] puts -nonewline $page {<html><head></head><body><table border=0 cellspacing=0 cellpadding=0>} foreach row {$source data} { puts -nonewline $page {<tr>} foreach color $row { puts -nonewline $page "<td width=1 height=1 color=$color></td>" } puts -nonewline $page {</tr>} } puts -nonewline $page {</table></body></html>} }