Richard Suchenwirth 2004-08-18 - From [
1] I had obtained some GIF images that together form a map of the world's time zones, such that 3 rows of 3 GIF images each make the whole picture. I wanted to re-compose them into one image, and so I wrote this code, which takes a list of lists (one per row) of filenames, and pastes them together, according to this specification, into one big
photo image, which is returned to the caller. Easy enough. The following code worked on my test case - feel free to try it on others! :
proc image'compose filenames {
set img [image create photo]
set x 0
set y 0
foreach row $filenames {
foreach file $row {
set tmp [image create photo -file $file]
$img copy $tmp -to $x $y
incr x [image width $tmp]
image delete $tmp
}
set x 0
set y [image height $img]
}
set img
}