set cvs [canvas .c -width 200 -height 200]
grid $cvs -row 1 -column 1

button .b -text Quit -command exit
grid .b -row 2 -column 1

set im1 [image create photo -height 200 -width 200]
$cvs create image 0 0 -image $im1 -anchor nw

for {set i 0} {$i < 200} {incr i 20} {
  set color [format #%02x%02x%02x $i $i $i]
  $im1 put $color -to $i $i [expr $i+19] [expr $i+19]
}
