[GRASSLIST:369] Re: NVIZ : getting a script to run
Glynn Clements
glynn.clements at virgin.net
Thu Jun 12 10:03:53 EDT 2003
H Bowman wrote:
> > > Use the ImageMagick tools:
> > > pnmtopng < dump.ppm > dump.png
> > > sgitopnm < dump.rgb | pnmtopng > dump.png
> >
> > The question is : does it work *inside* the nviz script ? Does "dump"
> > correspond to a temp file created during the script, before the
> > picture gets its proper name ? If not, well, back to the beginning.
>
> Those commands are just for the Bash prompt.
> By with the NVIZ script do you mean in:
> /usr/local/grass5/etc/nviz2.2/scripts/nviz2.2_script
> ?
> That's a Tcl/Tk script, I'd guess there would be a "system()" command in
> tcl, but I wouldn't know what it was.
"exec", e.g.
exec pnmtopng < file.ppm > file.png
Although, if you're just looking to save space, and will be converting
back to PPM for processing, you may as well just gzip the PPM file:
exec gzip -9 file.ppm
PNG uses the gzip compression algorithm, so a .png and a .ppm.gz would
be roughly the same size.
> > Actually, I thought about a workaround: instead of relying on nviz to
> > loop on the maps, I rely on my bash parent. That way, I write only one
> > PPM that I can convert on the fly.
>
> Another ugly hack might be to have a cron job which runs every 20
> minutes: copy *.ppm to a temporary directory, convert everything in that
> directory to PNG, delete *.ppm in that dir, and move the PNG files back.
The key issue here is that you need to avoid processing a PPM that's
in the process of being written, so check the file's size or
last-modified time first.
> > Great ! Can I compile the latest version of NVIZ on a old version of
> > GRASS ? IS there a pb of backward compatibility ?
You would definitely need to use the CVS HEAD version of the OGSF
library (src/libes/ogsf), and I can't entirely rule out the
possibility that the latest NVIZ might depend upon some other changes
which have been made since 5.0.2.
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-user
mailing list