# satenhance.tcl 08-28-2005 Steve Redler IV # sriv 10-27-2012 updated to new url for source image and adjusted the comb filter parameters package require Tk package require http canvas .c -width 1000 -height 900 pack .c proc comb {x spec} { foreach {value limit} $spec {if {$x<$limit} break} set value } proc colorize {image} { # get image sizes set width [image width $image] set height [image height $image] set height [image height $image] set filterlist { #646400 170 #a0a000 175 #f0f000 180 #000b64 185 #0064aa 190 #00d7e6 195 #720000 200 #960000 205 #d90000 210 #ff5b62 215 #f97f7c 220 #3cd612 225 #84f780 230 #323232 240 #ffffff 254 } # compute new colors for {set y 0} {$y < $height} {incr y} { #puts "row=$y" set row {} for {set x 0} {$x < $width} {incr x} { # save transparency lappend trans $x $y [$image transparency get $x $y] # compute the new color foreach {r g b} [$image get $x $y] break if {$r < 170} { lappend row [format #%02x%02x%02x $r $b $g] } else { lappend row [comb $r $filterlist] } } # update the row of the image $image put \{$row\} -to 0 $y update } # restore transparency foreach {x y t} $trans { $image transparency set $x $y $t } } set imagedata [http::data [http::geturl http://www.ssec.wisc.edu/data/geo/east/latest_east_ir2_conus.gif]] image create photo satimage -data $imagedata .c create image 0 0 -image satimage -tag imgtag -anchor nw update after 100 [colorize satimage] update satimage write latest_eastir_eh.gif -format gif
21-november-2006 Harm Olthof: changed proc colorize to use proc argument in the put statement.2011-03-19 tomas Nifty! Some lines in the program were doubled, I don't know why. I removed them.