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]
-o, --output Output raster dataset [required]
-b, --band Band(s) (1-based index, 'mask' or 'mask:') [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)
Options:
-f, --of, --format, --output-format Output format ("GDALG" allowed)
--co, --creation-option = Creation option [may be repeated]
--overwrite Whether overwriting existing output is allowed
Mutually exclusive with --append
--append Append as a subdataset to existing output
Mutually exclusive with --overwrite
--mask Mask band (1-based index, 'mask', 'mask:' or 'none')
Advanced Options:
--if, --input-format Input formats [may be repeated]
--oo, --open-option = Open options [may be repeated]
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
Standard options
-f, --of, --format, --output-format
Which output raster format to use. Allowed values may be given
by gdal --formats | grep raster | grep rw | sort
--co =
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.
--overwrite
Allow program to overwrite existing target file or dataset.
Otherwise, by default, gdal errors out if the target file or
dataset already exists.
--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.
--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)
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.
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: 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-2025
November 7, 2025 GDAL-RASTER-SELECT(1)