.TH GMT2RGB 1gmt "15 Jul 2011" "GMT 4.5.7" "Generic Mapping Tools" .SH NAME gmt2rgb \- Converting a grid file, a raw, or a Sun raster file to r/g/b grids .SH SYNOPSIS \fBgmt2rgb\fP \fIinfile\fP \fB\-G\fP\fItemplate\fP [ \fB\-C\fP\fIcptfile\fP ] [ \fB\-F\fP ] [ \fB\-I\fP\fIxinc\fP[\fBm\fP|\fBc\fP][/\fIyinc\fP[\fBm\fP|\fBc\fP]] ] [ \fB\-L\fP\fIlayer\fP ] [ \fB\-R\fP\fIxmin\fP/\fIxmax\fP/\fIymin\fP/\fIymax\fP[\fBr\fP] ] [ \fB\-V\fP ] [ \fB\-W\fP\fIwidth\fP/\fIheight\fP[/\fIn_bytes\fP] ] .SH DESCRIPTION \fBgmt2rgb\fP reads one of three types of input files: (1) A Sun 8-, 24-, or 32-bit raster file; we the write out the red, green, and blue components (0-255 range) to separate grid files. Since the raster file header is limited you may use the \fB\-R\fP, \fB\-F\fP, \fB\-I\fP options to set a complete header record [Default is simply based on the number of rows and columns]. (2) A binary 2-D grid file; 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 raster file. Since raw rasterfiles have no header, you have to give the image dimensions via the \fB\-W\fP option. .TP \fIinfile\fP The (1) Sun raster file, (2) 2-D binary grid file, or (3) raw raster file to be converted. .TP \fB\-G\fP Provide an output name template for the three output grids. The template should be a regular grid file name except it must contain the string %c which on output will be replaced by r, g, or b. .SH OPTIONS .TP \fB\-C\fP name of the color palette table (for 2-D binary input grid only). .TP \fB\-F\fP Force pixel node registration [Default is gridline registration]. (Node registrations are defined in \fBGMT\fP Cookbook Appendix B on grid file formats.) .TP \fB\-I\fP \fIx_inc\fP [and optionally \fIy_inc\fP] is the grid spacing. Optionally, append a suffix modifier. \fBGeographical (degrees) coordinates\fP: Append \fBm\fP to indicate arc minutes or \fBc\fP to indicate arc seconds. If one of the units \fBe\fP, \fBk\fP, \fBi\fP, or \fBn\fP is appended instead, the increment is assumed to be given in meter, km, miles, or nautical miles, respectively, and will be converted to the equivalent degrees longitude at the middle latitude of the region (the conversion depends on \fBELLIPSOID\fP). If /\fIy_inc\fP is given but set to 0 it will be reset equal to \fIx_inc\fP; otherwise it will be converted to degrees latitude. \fBAll coordinates\fP: If \fB=\fP is appended then the corresponding max \fIx\fP (\fIeast\fP) or \fIy\fP (\fInorth\fP) may be slightly adjusted to fit exactly the given increment [by default the increment may be adjusted slightly to fit the given domain]. Finally, instead of giving an increment you may specify the \fInumber of nodes\fP desired by appending \fB+\fP to the supplied integer argument; the increment is then recalculated from the number of nodes and the domain. The resulting increment value depends on whether you have selected a gridline-registered or pixel-registered grid; see Appendix B for details. Note: if \fB\-R\fP\fIgrdfile\fP is used then grid spacing has already been initialized; use \fB\-I\fP to override the values. .TP \fB\-L\fP Output only the specified layer (r, g, or b). [Default outputs all 3 layers]. .TP \fB\-R\fP \fIxmin\fP, \fIxmax\fP, \fIymin\fP, and \fIymax\fP specify the Region of interest. For geographic regions, these limits correspond to \fIwest, east, south,\fP and \fInorth\fP and you may specify them in decimal degrees or in [+-]dd:mm[:ss.xxx][W|E|S|N] format. Append \fBr\fP if lower left and upper right map coordinates are given instead of w/e/s/n. The two shorthands \fB\-Rg\fP and \fB\-Rd\fP stand for global domain (0/360 and -180/+180 in longitude respectively, with -90/+90 in latitude). Alternatively, specify the name of an existing grid file and the \fB\-R\fP settings (and grid spacing, if applicable) are copied from the grid. For calendar time coordinates you may either give (a) relative time (relative to the selected \fBTIME_EPOCH\fP and in the selected \fBTIME_UNIT\fP; append \fBt\fP to \fB\-JX\fP|\fBx\fP), or (b) absolute time of the form [\fIdate\fP]\fBT\fP[\fIclock\fP] (append \fBT\fP to \fB\-JX\fP|\fBx\fP). At least one of \fIdate\fP and \fIclock\fP must be present; the \fBT\fP is always required. The \fIdate\fP string must be of the form [-]yyyy[-mm[-dd]] (Gregorian calendar) or yyyy[-Www[-d]] (ISO week calendar), while the \fIclock\fP string must be of the form hh:mm:ss[.xxx]. The use of delimiters and their type and positions must be exactly as indicated (however, input, output and plot formats are customizable; see \fBgmtdefaults\fP). .TP \fB\-V\fP Selects verbose mode, which will send progress reports to stderr [Default runs "silently"]. .TP \fB\-W\fP Sets the size of the raw raster file. By default an RGB file (which has 3 bytes/pixel) is assumed. For RGBA files use \fIn_bytes\fP = 4. Use \fB\-W\fP for guessing the image size of a RGB raw file, and \fB\-W\fP\fI=/=/4\fP 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. .SH EXAMPLES To use the color palette topo.cpt to create r, g, b component grids from hawaii_grv.grd file, use .br .sp \fBgmt2rgb\fP hawaii_grv.grd \fB\-C\fPtopo.cpt \fB\-G\fPhawaii_grv_%c.grd .br .sp To output the red component from the Sun raster radiation.ras file, use .br .sp \fBgmt2rgb\fP radiation.ras \fB\-L\fPr \fB\-G\fPcomp_%c.grd .SH "SEE ALSO" .IR gmtdefaults (1), .IR GMT (1), .IR grdedit (1), .IR grdimage (1), .IR grdmath (1), .IR grdview (1)