Wednesday, June 21, 2017

Combine separate gray scale TIFF images into a single RGB TIFF image

Some multi spectral cameras capture images as individual gray scale TIFF images - each file containing data for a single light wavelength e.g. red, green, blue, or infra-red. Example files are the gray scale TIFF files shown below, each file representing a single color band.

Combining these individual color bands into a single RGB color composite can be done using the free and open source ImageMagick software, as shown in the steps below.

  1. Open up a Command Prompt.
  2. At the prompt, type in the ImageMagick convert command:

    C:\> magick convert -verbose band_red.tif -channel R band_green.tif -channel G band_blue.tif -channel B -combine -channel RGB -alpha off -colorspace sRGB out_rgb.tif

    Note:
    band_*.tif are the input TIFF files. Each input file must be followed with the correct channel option.
    out_rgb.tif is the output RGB TIFF file.
    -verbose is used to print out processing messages.
    -combine -channel RGB are for combining the bands.
    -alpha off is used to disable the creation of the alpha channel in the output RGB file.
    -colorspace sRGB is used to set the output color space.
  3. Run the command.

    Processing messages appear. The output file out_rgb.tif is created.
  4. Open up the resultant file in an image editor, e.g. GIMP.

    The file is displayed in color and the the bands are combined into the image's red, green and blue channels.

No comments: