Exporting Raster Formats From Grass

ghaverla at freenet.edmonton.ab.ca ghaverla at freenet.edmonton.ab.ca
Sat Apr 6 07:00:00 EST 1996


a>#1/1
references: <9604042231.AA26888 at ulysses.sis.ualberta.ca>
content-type: TEXT/PLAIN; charset=US-ASCII
organization: University of Illinois at Urbana
mime-version: 1.0
reply-to: grassu-list at pandora.cecer.army.mil
newsgroups: info.grass.user
originator: daemon at ux1.cso.uiuc.edu



On Thu, 4 Apr 1996, srpage (hansman at erols.com) wrote:

> From grass-lists-owner at moon.cecer.army.mil Wed Apr  3 18:38:10 1996
> Message-Id: <199604032325.SAA17321 at mail.erols.com>
> Date: Wed, 03 Apr 96 18:22:38 -0800
> From: srpage <hansman at erols.com>
> X-Mailer: Mozilla 1.22KIT (Windows; U; 16bit)
> Mime-Version: 1.0
> Sender: grass-lists-owner at moon.cecer.army.mil
> Reply-To: grassu-list at moon.cecer.army.mil
> Precedence: Bulk
> To: grassu-list at max.cecer.army.mil
> Subject: Exporting Raster Formats From Grass
> Content-Transfer-Encoding: 7bit
> Content-Type: text/plain; charset=us-ascii
> 
> I am running Xgrass4.1 on Linux, and have created some 3D images based on 
> DEM and other raster data in the graphics monitor.   Is there any way to 
> "export" these images from the monitor into a format (tif, gif, jpg, bmp, 
> ect.) I can use with a Windows based graphics program such as Corel or 
> Photoshop?
> 
> Thanks,
> 
> Randy Page
> 
> hansman at erols.com

Most windows systems have a ``native'' format, and X-Windows is no
exception.  There is a program (xwd) which will create a X-Windows
Dump (or screen dump) in whatever your present working directory
(unless you use a complete path name).  See your man pages for
the exact format and any applicable options.  We almost always
specify -nobdrs (no borders) with our dumps.

There are a zillion other graphics formats, and unless they are specific
to MS-Curtains (oops, should read MS-Windows :-), they probably
have some use on a Linux (or other UNIX-like OS) and there are probably
utilities provided with the Linux distribution or available via FTP
to convert from xwd to whatever your heart desires.  If graphics
interchange format (.gif) is what you want, the program xv (x-view ?)
can do that in one step and is an interactive program.  Launch the
xv program (might be an application from your window manager, or from
a command line), hit the right mouse button to display the command
screen, Choose the LOAD option, LOAD the file in question (xv will
display the file in another window), and then SAVE the file as
a *.gif file.  XV has quite a few graphics formats that it knows about.
XV is (I believe) a shareware program, if it is useful to you
in a professional context (work related), the author would appreciate
a small payment ($25 US or something to that effect).

Their also exists a number of programs of the form  xwdtoXXX, where
XXX is some other kind of graphics file format.  You may be lucky
and find one which is exactly the type of format you require, if not
most of these programs can be strung together as UNIX pipes.  Here
is a hypothetical example:
 xwdtoABC <file.xwd | ABCtoDEF | DEFtoGHI | GHItotiff >file.tiff

If you find yourself using a string of commands like this on a regular
basis, it is relatively easy to put this string of commands into a
text (or script) file, and have your favorite script interpretter
do its thing.

Examples:
--------
# sh, ksh, or bash:
xwdtoABC <$1 | ABCtoDEF | DEFtoGHI | GHItotiff >$2

--------
#!/usr/bin/perl        # Call perl to execute this script
system( "xwdtoABC <$ARGV[1] | ABCtoDEF | DEFtoGHI | GHItotiff >$ARGV[2]" );

Of course, a ``production'' script file should check for existence of
the first file (the .xwd file) and the nonexistence of the .tiff file.
X-Windows comes from MIT originally, so looking at the FTP archives at
MIT may produce a conversion program which goes directly from xwd to
whatever your most useful format is in one step.

Gordon Haverland, P.Eng.
Precision Farming Project
Alberta Agriculture

  and

Gordon Haverland, B.Sc. M.Eng.       Area: Materials Science and Engineering 
101  9504 182 St. NW                 Professional Status: Available
Edmonton, AB, CA  T5T 3A7
403/481-8019                         Email: ghaverla at freenet.edmonton.ab.ca






More information about the grass-user mailing list