From Open Foris Wiki

Jump to: navigation, search

Create a muti-band image stack

Usage: oft-stack [-ot {Byte/Int16/UInt16/UInt32/Int32/Float32/Float64/CInt16/CInt32/CFloat32/CFloat64}] [-um <maskfile>] <-o outputfile> <inputfiles>

-o outputfile - The name of the output file to be created (include extension).
inputfiles - A set of input files (include extension), each separated by a space.


-ot - Optional. The output image type. By default, the first input image type is used.
-um - Optional. A mask file used to restrict the extent of the processing.
  • oft-stack builds an image stack from input files in the order of appearance. By default, the output format and type of the first input file is used.
  • N.B.: The images need to have exactly the same size (rows x cols)


To create a 6-band stack of Landsat data from individual input rasters in .TIF format.

 oft-stack -o landsat7band.tif landsatb1.tif landsatb2.tif landsatb3.tif landsatb4.tif landsatb5.tif landsatb7.tif

the above can be written using wildcards...

oft-stack -o landsat7band.tif landsat*.tif


1. Open your working directory using

cd /home/...

2. Now we run oft-stack using two input images landsat_t1.tif and landsat_t2.tif to create the output stack image called stack.tif:

oft-stack -o stack.tif landsat_t1.tif landsat_t2.tif

3. Take a closer look at your output in QGIS and you will see that stack.tif has 13 bands (landsat_t1.tif contains 7 bands and landsat_t2.tif 6 bands). Or print the raster information on your screen by typing in your terminal

gdalinfo stack.tif 

Back to Open Foris Toolkit Main Page

Back to Tools & Exercises

Personal tools