We assume here that the library is loaded and that the operators are created. We create a TclTk proc that create a Tk image in a toplevel. The image is read from the CImageGrey one, by writing the CImageGrey on the disk (this is the simplest to do right now, because the -data option of the Tk image does only takes gif image! A pity to my opinion.)
proc display {img} {
File PGMWrite [$img cget -this] test.pgm
set res [image create photo img$img -file test.pgm]
toplevel .$img label .$img.label -text [format "pos = (%4d,%4d) col = %4d" 0 0 0] -anchor w pack .$img.label
canvas .$img.c .$img.c create image 1 1 -anchor nw -image $res pack .$img.c -fill both -expand true
set w [$img WidthGet] set h [$img HeightGet] incr w 5 incr h 15 wm geometry .$img [set w]x[set h]
bind .$img <Motion> { catch { set imgname [lindex [split %W .] 1] set color [lindex [img$imgname get %x %y] 0] set px %x set py %y set displaytxt "pos = (%x,%y) col = $color" .$imgname.label configure -text "$displaytxt" } } #
bind .$img <Control-c> {destroy .[lindex [split %W .] 1]}
bind .$img <Configure> { set imgname [lindex [split %W .] 1] }
}