rio stack

Stack a number of bands from one or more input files into a multiband dataset.

Input datasets must be of a kind: same data type, dimensions, etc. The output is cloned from the first input.

By default, rio-stack will take all bands from each input and write them in same order to the output. Optionally, bands for each input may be specified using a simple syntax:

–bidx N takes the Nth band from the input (first band is 1).

—bidx M,N,0 takes bands M, N, and O.

–bidx M..O takes bands M-O, inclusive.

—bidx ..N takes all bands up to and including N.

–bidx N.. takes all bands from N to the end.

Examples, using the Rasterio testing dataset, which produce a copy.

rio stack RGB.byte.tif -o stacked.tif

rio stack RGB.byte.tif –bidx 1,2,3 -o stacked.tif

rio stack RGB.byte.tif –bidx 1..3 -o stacked.tif

rio stack RGB.byte.tif –bidx ..2 RGB.byte.tif –bidx 3.. -o stacked.tif



-o, --output <output>

Path to output file (optional alternative to a positional arg).

-f, --format, --driver <driver>

Output format driver.

-b, --bidx <bidx>

Indexes of input file bands.


Set RGB photometric interpretation.


Always overwrite an existing output file.

--co, --profile <NAME=VALUE>

Driver specific creation options. See the documentation for the selected output driver for more information.



Required argument(s)