GREY2RGB

Greyscale to RGB Color Mapping


EnvironmentsPYTHON :: EASI
Quick linksDescription :: Parameters :: Parameter descriptions :: Details :: Examples :: Algorithm

Back to top

Description


GREY2RGB converts greyscale raster channels into RGB images using a colormap. The output RGB image retains the same projection and spatial resolution.
Back to top

Parameters


Name Type Caption Length Value range
MFILE * String Name of input file, folder, or text file 1 - 192  
DBIC Integer Input raster channels 0 - 1 Default: 1
COLORMAP String Name of color map to apply 0 - 192 Default: jet
INMIN Float Min Input Value 0 - 1  
INMAX Float Max Input Value 0 - 1  
CLAMPMET String Method for clamping out of range values 0 - 192 NODATA | CLAMP
Default: CLAMP
NUMBIN Integer Number of bins for input histogram 0 - 1 1 -
FILO String Name of output file or folder 0 - 192  

* Required parameter
Back to top

Parameter descriptions

MFILE

The name of an image file, a folder, or a text file that contains the input images to process.

For information about basic use of an MFILE with CATALYST Professional algorithms, see Using an MFILE with a CATALYST Professional algorithm.

The MFILE text file format for GREY2RGB is INPUT_FILENAME;DBIC;OUTPUT_FILENAME.

DBIC

Specifies the input channel to be colorized. All channel types are supported. Complex channels (C32R, C16S) will be converted to intensity before applying the selected colormap.

COLORMAP

The colormap to apply to the input greyscale channel (DBIC) to get the output RGB image.

The following colormaps are defined:

Run with '?' to list valid colormap options.

Custom colormap files can be created and installed into the <install-dir>/etc/color_tables directory. Simply create a text file in one of two formats:

INMIN

The minimum value to be mapped in the colormap space to get the output RGB image.

If INMIN is blank, the 0.5 percentile of all the input data will be used. This is equivalent to generating a histogram of all the data and then doing a 0.5% tail trim on the bottom end.

INMAX

The maximum value to be mapped in the colormap space to get the output RGB image.

If INMAX is blank, the 99.5 percentile of all the input data will be used. This is equivalent to generating a histogram of all the data and then doing a 0.5% tail trim on the top end.

CLAMPMET

Option to apply to the values of the input raster channel that are outside the INMIN and INMAX values.

When CLAMPMET=CLAMP, all numerical values lower or greater than INMIN and INMAX are respectively assigned to the first and last colors of the selected colormaps.

When CLAMPMET=NODATA, all numerical values less than or greater than INMIN and INMAX are assigned to NoData in the output 8-bit (8U) RGB image.

NUMBIN

The number of bins are used to control how many colors from the selected colormap are used for the greyscale to RGB transformation.

A high number of bins offers a continuous visual appearance while a low number of bins offers a "classification like" visual appearance.

If blank, the algorithm will not histogram the data and will instead interpolate all color values in the colormap.

FILO

The name of the PCIDSK file to be created to contain the RGB image after applying the colormap. The output file will consist of 3 x 8U channels.

The output file projection, dimensions and spatial resolution are the same than the input file. All file metadata and segments (such as GCPs, text, orbit, incidence angle array and binary math model) are transferred to the output file.

Back to top

Details

GREY2RGB converts single greyscale raster channel into an RGB image using a colormap. The output RGB image retains the same projection and spatial resolution. GREY2RGB is useful to enhance biophysical variables such as vegetation or biomass indices and other mathematical parameters such as InSAR pair coherences, InSAR deformation maps or polarimetric decomposition parameters (alpha and beta angles, entropy, etc).

GREY2RGB is also useful to represent images from a time series with a common colormap and a fixed color scale.

Back to top

Examples

Process all .pix files in inputs/ into a consistently colored set of output images in outputs/.

        MFILE="inputs/*.pix"
        DBIC=1
        COLORMAP="hsv"
        INMIN=
        INMAX=
        CLAMPMET="clamp"
        NUMBIN=
        FILO="outputs/"
        RUN GREY2RGB
      

Process a single .pix file into a colored image.

        MFILE="input.pix"
        DBIC=1
        COLORMAP="hsv"
        INMIN=
        INMAX=
        CLAMPMET="clamp"
        NUMBIN=
        FILO="output.pix"
        RUN GREY2RGB
      
Run GREY2RGB with the following mfile text file mfile.txt:
          workdir1/output.pix;;colorized/output1.pix
          workdir2/output.pix;;colorized/output2.pix
          

Discretize the output into 10 colors sampled from the jet_inv colormap to form a classified-looking image.

        MFILE="mfile.txt"
        DBIC=
        COLORMAP="jet_inv"
        INMIN=-1
        INMAX=1
        CLAMPMET="nodata"
        NUMBIN=10
        FILO=
        R GREY2RGB
      
Back to top

Algorithm

GREY2RGB converts single greyscale raster channel into a RGB image using a colormap. The output RGB image retains the same projection and spatial resolution. GREY2RGB is useful to enhance biophysical variables such as vegetation or biomass indices and other mathematical parameters such as InSAR pair coherences, InSAR deformation maps or polarimetric decomposition parameters (alpha and beta angles, entropy, etc).

GREY2RGB is also useful to represent images from a time series with a common colormap and a fix color scale.

GREY2RGB offers a set of 16 standard colormaps with jet being the default (figure 1).

The number bins is used to control how many colors of the selected colormap are used for the greyscale to RGB transformation. A high number of bins offers a continuous visual appearance while a low number of bins offers a "classification like" visual appearance (figure 2).

© PCI Geomatics Enterprises, Inc.®, 2026. All rights reserved.