man gmt2rgb () - Converting a grdfile, a raw, or a Sun rasterfile to r/g/b grids


gmt2rgb - Converting a grdfile, a raw, or a Sun rasterfile to r/g/b grids


gmt2rgb infile -Gtemplate [ -Ccptfile ] [ -F ] [ -Ix_inc[m|c][/y_inc[m|c]] ] [ -Llayer ] [ -Rwest/east/south/north[r] [ -V ]


gmt2rgb reads one of three types of input files: (1) A Sun 8-, 24-, or 32-bit rasterfile; we the write out the red, green, and blue components (0-255 range) to separate grid files. Since the rasterfile header is limited you may use the -R, -F, -I options to set a complete header record [Default is simply based on the number of rows and columns]. (2) A binary 2-D grdfile; we then convert the z-values to red, green, blue via the provided cpt file. Optionally, only write out one of the r, g, b, layers. (3) A RGB or RGBA raw rasterfile. Since raw rastefiles have no header, you have to give the image dimensions via the -W option.

The (1) Sun rasterfile, (2) 2-D binary grdfile, or (3) raw rasterfile to be converted.
Provide an output name template for the three output grids. The template should be a regular gridfile name except it must contain the string %c which on output will be replaced by r, g, or b.


name of the color palette table (for 2-D binary input grid only).
Will force pixel registration [Default is grid registration].
x_inc [and optionally y_inc] is the grid spacing. Append m to indicate minutes or c to indicate seconds.
Output only the specified layer (r, g, or b). [Default outputs all 3 layers].
xmin, xmax, ymin, and ymax specify the Region of interest. For geographic regions, these limits correspond to west, east, south, and north and you may specify them in decimal degrees or in [+-]dd:mm[][W|E|S|N] format. Append r if lower left and upper right map coordinates are given instead of wesn. The two shorthands -Rg -Rd stand for global domain (0/360 or -180/+180 in longitude respectively, with -90/+90 in latitude). For calendar time coordinates you may either give relative time (relative to the selected TIME_EPOCH and in the selected TIME_UNIT; append t to -JX|x), or absolute time of the form [date]T[clock] (append T to -JX|x). At least one of date and clock must be present; the T is always required. The date string must be of the form [-]yyyy[-mm[-dd]] (Gregorian calendar) or yyyy[-Www[-d]] (ISO week calendar), while the clock string must be of the form hh:mm:ss[.xxx]. The use of delimiters and their type and positions must be as indicated (however, input/output and plotting formats are flexible).
Selects verbose mode, which will send progress reports to stderr [Default runs "silently"].
Sets the size of the raw raster file. By default an RGB file (which has 3 bytes/pixel) is assumed. For RGBA files use n_bytes = 4. Use -W for guessing the image size of a RGB raw file, and -W=/=/4 if the raw image is of the RGBA type. Notice that this might be a bit slow because the guessing algorithm makes uses of FFTs.


To use the color palette topo.cpt to create r, g, b component grids from hawaii_grv.grd file, use

gmt2rgb hawaii_grv.grd -Ctopo.cpt -Ghawaii_grv_%c.grd

To output the red component from the Sun raster radiation.ras file, use

gmt2rgb radiation.ras -Lr -Gcomp_%c.grd