[MEd] 2006-02-23: Just a few lines of code to [base64]-encode an image (or any other file), I use it quite often for inline-gif images in my tcl-scripts. The generated code can be copied to clipboard and inserted in the script, the result may look like this: ====== button .b1 -image [image create photo -data { R0lGODlhEgASAIAAAAAAAP///yH5BAEAAAEALAAAAAASABIAAAIdjI+py+0G wEtxUmlPzRDnzYGfN3KBaKGT6rDmGxQAOw==}] pack .b1 ====== The following script requires [Tcllib]. Here we go: ====== package require base64 proc encode {} { .txt delete 1.0 end set fileID [open [tk_getOpenFile] RDONLY] fconfigure $fileID -translation binary set rawData [read $fileID] close $fileID set encodedData [base64::encode $rawData] .txt insert 1.0 $encodedData } proc clipcopy {} { clipboard clear clipboard append [.txt get 1.0 end] } wm title . {Base64 Gif Encoder} text .txt -wrap none -font {Courier 10} menu .mbar . configure -menu .mbar .mbar add command -label {Encode File} -command encode .mbar add command -label Copy2Clipboard -command clipcopy .mbar add command -label Exit -command {destroy .; exit} pack .txt -expand 1 -fill both encode ### End of Script ====== ---- [EKB] Also, I've got a more complicated Base64 Gif encoder on the [Windows Application Framework] page as an example of the framework. <> Category Binary Data