[GRASS-dev] animation missing pnmscale

Glynn,

I’ve made a lot of progress getting your TclTk replacement for Xganim into the GUI. However, I haven’t been able to make it animate anything. I finally tracked this down to the line…

catch {exec r.out.ppm input=$name output=- 2>@stderr | pnmscale $vscale >$tmpfile 2>@stderr}

This requires a program pnmscale. I don’t have pnmscale. Does it comes with GRASS and I somehow don’t have it or is it a 3rd party program?

Michael


Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On Sep 8, 2007, at 6:26 PM, Michael Barton wrote:

Glynn,

I've made a lot of progress getting your TclTk replacement for Xganim into the GUI. However, I haven't been able to make it animate anything. I finally tracked this down to the line...

catch {exec r.out.ppm input=$name output=- 2>@stderr | pnmscale $vscale >$tmpfile 2>@stderr}

This requires a program pnmscale. I don't have pnmscale. Does it comes with GRASS and I somehow don't have it or is it a 3rd party program?

Michael, you have to install it
http://netpbm.sourceforge.net/doc/index.html

Also I found in the pnmscale manual:
pnmscale was obsoleted by pamscale, introduced with Netpbm 10.20 (January 2004)

I have it on RedHat linux box but I don't have it on Mac or Ubuntu so apparently you have to install it yourself.

Helena

Michael
__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

_______________________________________________
grass-dev mailing list
grass-dev@grass.itc.it
http://grass.itc.it/mailman/listinfo/grass-dev

Check the source/macosx readme. I have build instructions there for the netpbm tools source (it's an annoying one to build). Knowing this tool is needed, I'll add it to my bundling for binaries when you get the xganim.tcl working (I already bundle a few other netpbm tools for other GRASS modules).

On Sep 8, 2007, at 5:26 PM, Michael Barton wrote:

Glynn,

I've made a lot of progress getting your TclTk replacement for Xganim into the GUI. However, I haven't been able to make it animate anything. I finally tracked this down to the line...

catch {exec r.out.ppm input=$name output=- 2>@stderr | pnmscale $vscale >$tmpfile 2>@stderr}

This requires a program pnmscale. I don't have pnmscale. Does it comes with GRASS and I somehow don't have it or is it a 3rd party program?

Michael

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

[Trillian] What are you supposed to do WITH a maniacally depressed robot?

[Marvin] You think you have problems? What are you supposed to do if you ARE a maniacally depressed robot? No, don't try and answer, I'm 50,000 times more intelligent than you and even I don't know the answer...

- HitchHiker's Guide to the Galaxy

I thought that of the (main?) goals of doing a TclTk animation replacement
for Xganim was so that we no longer needed motif/lesstif as a GRASS
dependency. While the TclTk animator is nicer looking than xganim, if
pnmscale is required, we just replace one dependency with another one. Maybe
there is another way to do this???

Michael

On 9/8/07 4:27 PM, "William Kyngesburye" <woklist@kyngchaos.com> wrote:

Check the source/macosx readme. I have build instructions there for
the netpbm tools source (it's an annoying one to build). Knowing
this tool is needed, I'll add it to my bundling for binaries when you
get the xganim.tcl working (I already bundle a few other netpbm tools
for other GRASS modules).

On Sep 8, 2007, at 5:26 PM, Michael Barton wrote:

Glynn,

I've made a lot of progress getting your TclTk replacement for
Xganim into the GUI. However, I haven't been able to make it
animate anything. I finally tracked this down to the line...

catch {exec r.out.ppm input=$name output=- 2>@stderr | pnmscale
$vscale >$tmpfile 2>@stderr}

This requires a program pnmscale. I don't have pnmscale. Does it
comes with GRASS and I somehow don't have it or is it a 3rd party
program?

Michael

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

[Trillian] What are you supposed to do WITH a maniacally depressed
robot?

[Marvin] You think you have problems? What are you supposed to do
if you ARE a maniacally depressed robot? No, don't try and answer,
I'm 50,000 times more intelligent than you and even I don't know the
answer...

- HitchHiker's Guide to the Galaxy

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

some netpbm tools are already needed by a couple other script modules, so it's not a new requirement. But it seems it is not mentioned in the GRASS requirements.

On Sep 8, 2007, at 11:00 PM, Michael Barton wrote:

I thought that of the (main?) goals of doing a TclTk animation replacement
for Xganim was so that we no longer needed motif/lesstif as a GRASS
dependency. While the TclTk animator is nicer looking than xganim, if
pnmscale is required, we just replace one dependency with another one. Maybe
there is another way to do this???

Michael

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

Earth: "Mostly harmless"

- revised entry in the HitchHiker's Guide to the Galaxy

Michael Barton wrote:

I've made a lot of progress getting your TclTk replacement for Xganim into
the GUI. However, I haven't been able to make it animate anything. I finally
tracked this down to the line...

catch {exec r.out.ppm input=$name output=- 2>@stderr | pnmscale $vscale
>$tmpfile 2>@stderr}

This requires a program pnmscale. I don't have pnmscale. Does it comes with
GRASS and I somehow don't have it or is it a 3rd party program?

xganim.tcl can probably be modified to rescale the image itself, using
the -zoom and -subsample options to the "copy" image command (see the
photo(n) manpage), but that will probably be slower than using
pnmscale.

Also, I don't think that those options can be combined, so you would
have to zoom the image first then subsample the zoomed image. One
consequence is that it may not be practical to get the exact size
required (the zoom factor needs to be reasonably small to avoid
creating a huge intermediate image).

If the lack of pnmscale is the only issue, I can create a local
version.

The main question is whether the Tcl/Tk version is fast enough to act
as a replacement for xganim. When I originally posted it, the comments
suggested that the speed difference was enough that xganim needed to
be retained.

--
Glynn Clements <glynn@gclements.plus.com>

Is netpbm available for Windows?

Michael

On 9/8/07 9:25 PM, "William Kyngesburye" <woklist@kyngchaos.com> wrote:

some netpbm tools are already needed by a couple other script
modules, so it's not a new requirement. But it seems it is not
mentioned in the GRASS requirements.

On Sep 8, 2007, at 11:00 PM, Michael Barton wrote:

I thought that of the (main?) goals of doing a TclTk animation
replacement
for Xganim was so that we no longer needed motif/lesstif as a GRASS
dependency. While the TclTk animator is nicer looking than xganim, if
pnmscale is required, we just replace one dependency with another
one. Maybe
there is another way to do this???

Michael

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

Earth: "Mostly harmless"

- revised entry in the HitchHiker's Guide to the Galaxy

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On 9/9/07 7:02 AM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

Also, I don't think that those options can be combined, so you would
have to zoom the image first then subsample the zoomed image. One
consequence is that it may not be practical to get the exact size
required (the zoom factor needs to be reasonably small to avoid
creating a huge intermediate image).

I played around with TclTk rescaling a little when initially working out how
to display GRASS maps in a Tcltk canvas and was disappointed in how it
worked--especially quality.

If the lack of pnmscale is the only issue, I can create a local
version.

This would be especially good for Windows users. Maybe just build it into
r.out.ppm???

The main question is whether the Tcl/Tk version is fast enough to act
as a replacement for xganim. When I originally posted it, the comments
suggested that the speed difference was enough that xganim needed to
be retained.

I was wondering this too. I'd originally thought that the best way to go
about this was to render all the maps to PPM first, and then display the
animation in a second step. But I was able to get the TclTk animation
running without scaling so that I could continue to get the rest of it
working. I'm surprised at how fast it runs. The maps I'm testing are very
simple. Is the speed of r.out.ppm affected by the amount of non-null data or
just the total number of cells? If the latter, then it may well be quite
fast enough.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

William Kyngesburye wrote:

some netpbm tools are already needed by a couple other script
modules, so it's not a new requirement. But it seems it is not
mentioned in the GRASS requirements.

Do you have a list? netpbm is rather fat; especially if
you only want a few lines of code from it.

Markus
--
View this message in context: http://www.nabble.com/animation-missing-pnmscale-tf4407452.html#a12582052
Sent from the Grass - Dev mailing list archive at Nabble.com.

These are the ones I've found so far (searching for 'netpbm'):

ppmtompeg: r.out.mpeg
pngtopnm: d.out.gpsdrive
pnmtojpeg: d.out.gpsdrive
pnmscale: xganim.tcl

or by module:

d.out.gpsdrive: pngtopnm, pnmtojpeg
r.out.mpeg: ppmtompeg (but can also use mpeg_encode instead)
xganim.tcl: pnmscale

NetPBM is also mentioned in:

drivers/HTMLMAP
drivers/PNG
NVIZ
r.in/out.gdal (as a format)
r.out.ppm
r.texture

On Sep 9, 2007, at 2:21 PM, Markus Neteler wrote:

William Kyngesburye wrote:

some netpbm tools are already needed by a couple other script
modules, so it's not a new requirement. But it seems it is not
mentioned in the GRASS requirements.

Do you have a list? netpbm is rather fat; especially if
you only want a few lines of code from it.

Markus

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

Earth: "Mostly harmless"

- revised entry in the HitchHiker's Guide to the Galaxy

William Kyngesburye wrote:

These are the ones I've found so far (searching for 'netpbm'):

ppmtompeg: r.out.mpeg

This is bound to require some kind of external tool, be it ppmtompeg,
mencoder (from mplayer), etc.

pngtopnm: d.out.gpsdrive

This is gratuitous. The PNG file is generated by the PNG driver, which
can generate PPM files by itself. Moreover, the ability to generate
PPM files is unconditional, while generating PNG files is optional
(using --without-png will disable it). The "PNG driver" name is a
historical artifact.

pnmtojpeg: d.out.gpsdrive

This will require an external utility, but "cjpeg" would have been a
better choice. "cjpeg" is built and installed along with libjpeg,
which pnmtojpeg requires. IOW, if you have pnmtojpeg, you already have
cjpeg, but the reverse isn't true.

pnmscale: xganim.tcl

xganim.tcl was something I hacked together in an hour to determine the
feasibility of replacing xganim. AFAICT, it isn't actually part of
GRASS (yet).

--
Glynn Clements <glynn@gclements.plus.com>

Michael Barton wrote:

> If the lack of pnmscale is the only issue, I can create a local
> version.

This would be especially good for Windows users. Maybe just build it into
r.out.ppm???

You can achieve the same result by running r.out.ppm with a different
region resolution.

I'm not sure why I didn't do that in xganim.tcl.

Is the speed of r.out.ppm affected by the amount of non-null data or
just the total number of cells?

It's affected by the speed of G__lookup_colors(), which has an
optimisation for runs of a single value: if the value matches the
previous value, it uses the previous colour. This can be significant
for FP maps, where you can't create a lookup table, but have to locate
and interpolate the appropriate colour rule.

But the same is true for xganim.

--
Glynn Clements <glynn@gclements.plus.com>

On 9/9/07 5:18 PM, "Glynn Clements" <glynn@gclements.plus.com> wrote:

William Kyngesburye wrote:

These are the ones I've found so far (searching for 'netpbm'):

ppmtompeg: r.out.mpeg

This is bound to require some kind of external tool, be it ppmtompeg,
mencoder (from mplayer), etc.

pngtopnm: d.out.gpsdrive

This is gratuitous. The PNG file is generated by the PNG driver, which
can generate PPM files by itself. Moreover, the ability to generate
PPM files is unconditional, while generating PNG files is optional
(using --without-png will disable it). The "PNG driver" name is a
historical artifact.

pnmtojpeg: d.out.gpsdrive

This will require an external utility, but "cjpeg" would have been a
better choice. "cjpeg" is built and installed along with libjpeg,
which pnmtojpeg requires. IOW, if you have pnmtojpeg, you already have
cjpeg, but the reverse isn't true.

pnmscale: xganim.tcl

xganim.tcl was something I hacked together in an hour to determine the
feasibility of replacing xganim. AFAICT, it isn't actually part of
GRASS (yet).

This won't need pnmscale. Glynn's solution to do scaling via adjusting the
resolution prior to running r.out.pnm works fine.

Michael

__________________________________________
Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

On Sep 10, 2007, at 11:57 AM, Michael Barton wrote:

This won't need pnmscale. Glynn's solution to do scaling via adjusting the
resolution prior to running r.out.pnm works fine.

Michael

Cool.

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Time is an illusion - lunchtime doubly so."

- Ford Prefect