GDAL-RASTER-SELECT(1) GDAL GDAL-RASTER-SELECT(1)
NAME
gdal-raster-select - Select a subset of bands from a raster dataset
Added in version 3.11.
SYNOPSIS
Usage: gdal raster select [OPTIONS]
Select a subset of bands from a raster dataset.
Positional arguments:
-i, --input Input raster datasets [required] [not available in pipelines]
-o, --output Output raster dataset [required] [not available in pipelines]
-b, --band Band(s) (1-based index, 'mask', 'mask:' or color interpretation such as 'red') [1.. values] [required]
Common Options:
-h, --help Display help message and exit
--json-usage Display usage as JSON document and exit
--config = Configuration option [may be repeated]
-q, --quiet Quiet mode (no progress bar or warning message) [not available in pipelines]
Options:
-f, --of, --format, --output-format Output format ("GDALG" allowed) [not available in pipelines]
--co, --creation-option = Creation option [may be repeated] [not available in pipelines]
--overwrite Whether overwriting existing output dataset is allowed [not available in pipelines]
Mutually exclusive with --append
--append Append as a subdataset to existing output [not available in pipelines]
Mutually exclusive with --overwrite
--exclude Exclude specified bands
--mask Mask band (1-based index, 'mask', 'mask:' or 'none')
Advanced Options:
--if, --input-format Input formats [may be repeated] [not available in pipelines]
--oo, --open-option = Open options [may be repeated] [not available in pipelines]
DESCRIPTION
gdal raster select can be used to select and re-order a subset of
raster bands from a raster dataset.
This subcommand is also available as a potential step of gdal raster
pipeline
GDALG OUTPUT (ON-THE-FLY / STREAMED DATASET)
This program supports serializing the command line as a JSON file using
the GDALG output format. The resulting file can then be opened as a
raster dataset using the GDALG: GDAL Streamed Algorithm driver, and
apply the specified pipeline in a on-the-fly / streamed way.
PROGRAM-SPECIFIC OPTIONS
--exclude
Added in version 3.13.
Modifies the behavior of the algorithm such that all bands are
selected, except the ones mentioned by --band.
--band
Select one or several input bands. Bands are numbered from 1.
Multiple values may be selected to select a set of input bands
to write to the output file, or to reorder bands. The special
value mask means the mask band of the first band of the input
dataset. The mask band of any band can be specified with
mask:. A mask band selected with --band will become an
ordinary band in the output dataset.
Starting with GDAL 3.13, can also be a color
interpretation such as "red", "green", "blue", "alpha", "nir",
etc.
--mask
Select one input band to create output dataset mask band.. Bands
are numbered from 1. The special value mask means the mask band
of the first band of the input dataset. The mask band of any
band can be specified with mask:. can be set to
none to avoid copying the global mask of the input dataset if it
exists. Otherwise it is copied by default, unless the mask is an
alpha channel, or if it is explicitly selected to be a regular
band of the output dataset (--band mask)
STANDARD OPTIONS
--append
Append input raster as a new subdataset to an existing output
file. Only works with drivers that support adding subdatasets
such as GTiff -- GeoTIFF File Format and GPKG -- GeoPackage
raster This also creates the output dataset if it does not exist
yet.
--co, --creation-option =
Many formats have one or more optional creation options that can
be used to control particulars about the file created. For
instance, the GeoTIFF driver supports creation options to
control compression, and whether the file should be tiled.
May be repeated.
The creation options available vary by format driver, and some
simple formats have no creation options at all. A list of
options supported for a format can be listed with the --formats
command line option but the documentation for the format is the
definitive source of information on driver creation options.
See Raster drivers format specific documentation for legal
creation options for each format.
--if, --input-format
Format/driver name to be attempted to open the input file(s). It
is generally not necessary to specify it, but it can be used to
skip automatic driver detection, when it fails to select the
appropriate driver. This option can be repeated several times
to specify several candidate drivers. Note that it does not
force those drivers to open the dataset. In particular, some
drivers have requirements on file extensions.
May be repeated.
--oo, --open-option =
Dataset open option (format specific).
May be repeated.
-f, --of, --format, --output-format
Which output raster format to use. Allowed values may be given
by gdal --formats | grep raster | grep rw | sort
--overwrite
Allow program to overwrite existing target file or dataset.
Otherwise, by default, gdal errors out if the target file or
dataset already exists.
RETURN STATUS CODE
The program returns status code 0 in case of success, and non-zero in
case of error (non-blocking errors emitted as warnings are considered
as a successful execution).
EXAMPLES
Example 1: Reorder a 3-band dataset with bands ordered Blue, Green, Red to
Red, Green, Blue
$ gdal raster select --band 3,2,1 bgr.tif rgb.tif --overwrite
Example 2: Select input bands by their color interpretation
$ gdal raster select --band red,green,blue input.tif rgb.tif --overwrite
Example 3: Convert a RGBA dataset to a YCbCR JPEG compressed GeoTIFF
$ gdal raster select --band 1,2,3 --mask 4 --co COMPRESS=JPEG,PHOTOMETRIC=YCBCR rgba.tif rgb_mask.tif
AUTHOR
Even Rouault
COPYRIGHT
1998-2026
August 18, 2026 GDAL-RASTER-SELECT(1)