PGM Grayscale Ramps

Try cutting and pasting this into the restricted Tcl interpreter, or return to the NArray page. content_type image/x-portable-graymap set wd 256 set ht 256 narray create pgm -type int $ht $wd pgm map { pre { direction = 1; offset = 0; } if (@0 == 0) && !(@1 % 8) { direction = -direction; offset = @#0 - offset; } [] = offset + direction * @0; } puts "P5\n$wd $ht\n255" pgm map { bio_write("stdout", "c", []); } (If the first line of the code is content_type foo then the interpreter will use foo as the content type and not do any special formatting of the results. Also I had to add the line: image/x-*; xv %s To my ~/.mailcap.)
Sam Shen, slshen@lbl.gov
Last modified: Tue Dec 6 20:13:48 1994