Posted to tcl by Stu at Tue Jul 15 02:20:09 GMT 2008view pretty

#! /bin/sh
# \
exec tclsh8.5 "$0" ${1+"$@"}
set f [open $argv0]
fconfigure $f -eofchar \x1a
read $f        
seek $f 1 current
fconfigure $f -translation binary
set d [read $f] 
close $f   
package require Tk
image create photo i1 -data $d
pack [label .l -image i1]
# EOF
^Z

There has to be a Control-Z at the end of the file.
Then, (assuming it's saves as 'i.tcl') in a shell:
$ cat i.tcl myimage.gif > viewmyimage.tcl
$ chmod u+x viewmyimage.tcl
$ ./viewmyimage.tcl
or
tclsh viewmyimage.tcl

This could be used for a single-file slideshow, for example.