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

  1. #! /bin/sh
  2. # \
  3. exec tclsh8.5 "$0" ${1+"$@"}
  4. set f [open $argv0]
  5. fconfigure $f -eofchar \x1a
  6. read $f
  7. seek $f 1 current
  8. fconfigure $f -translation binary
  9. set d [read $f]
  10. close $f
  11. package require Tk
  12. image create photo i1 -data $d
  13. pack [label .l -image i1]
  14. # EOF
  15. ^Z
  16.  
  17. There has to be a Control-Z at the end of the file.
  18. Then, (assuming it's saves as 'i.tcl') in a shell:
  19. $ cat i.tcl myimage.gif > viewmyimage.tcl
  20. $ chmod u+x viewmyimage.tcl
  21. $ ./viewmyimage.tcl
  22. or
  23. tclsh viewmyimage.tcl
  24.  
  25. This could be used for a single-file slideshow, for example.