GDAL-RASTER-SELECT(1)
β¨ GDAL-RASTER-SELECT β¨
okay bestie, this is the gdal-raster-select page from the GDAL manual set β and yes it's literally the vibe of "pick your faves and reorder the lineup". Let's get into it π
πΈ NAME πΈ
gdal-raster-select β select a subset of bands from a raster dataset.
π Added in version 3.11.
π¦ SYNOPSIS π¦
Usage: gdal raster select [OPTIONS] <INPUT> <OUTPUT> <BAND>
Select a subset of bands from a raster dataset.
Positional arguments:
-i, --input <INPUT> Input raster datasets [required] [not available in pipelines]
-o, --output <OUTPUT> Output raster dataset [required] [not available in pipelines]
-b, --band <BAND> Band(s) (1-based index, 'mask', 'mask:<band>' 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 <KEY>=<VALUE> 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> Output format ("GDALG" allowed) [not available in pipelines]
--co, --creation-option <KEY>=<VALUE> 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> Mask band (1-based index, 'mask', 'mask:<band>' or 'none')
Advanced Options:
--if, --input-format <INPUT-FORMAT> Input formats [may be repeated] [not available in pipelines]
--oo, --open-option <KEY>=<VALUE> Open options [may be repeated] [not available in pipelines]
π DESCRIPTION π
gdal raster select is the tool you pull out when you wanna select and re-order a subset of raster bands from a raster dataset. Band glow-up, basically. β¨
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 it'll apply the specified pipeline in an on-the-fly / streamed way. no cap, that's the whole flex π«Ά
π PROGRAM-SPECIFIC OPTIONS π
--excludeβ Modifies the behavior of the algorithm such that all bands are selected, except the ones mentioned by--band. (Added in version 3.13.) Sneaky little inversion, love that for her π--band <BAND>β Select one or several input bands. Bands are numbered from1. Multiple values may be selected to select a set of input bands to write to the output file, or to reorder bands. The special valuemaskmeans the mask band of the first band of the input dataset. The mask band of any band can be specified withmask:<band>. A mask band selected with--bandwill become an ordinary band in the output dataset.
Starting with GDAL 3.13, <BAND> can also be a color interpretation such as "red", "green", "blue", "alpha", "nir", etc. iconic tbh π
--mask <BAND>β Select one input band to create output dataset mask band.. Bands are numbered from1. The special valuemaskmeans the mask band of the first band of the input dataset. The mask band of any band can be specified withmask:<band>.<BAND>can be set tononeto 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 asGTiff -- GeoTIFF File FormatandGPKG -- GeoPackage raster. This also creates the output dataset if it does not exist yet. β¨--co, --creation-option <NAME>=<VALUE>β 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>β 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 <NAME>=<VALUE>β Dataset open option (format specific).
May be repeated.
-f, --of, --format, --output-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,gdalerrors 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). so like, 0 = slay, non-zero = not slay π«Ά
π₯ 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 <even.rouault@spatialys.com> β king behavior honestly π
π COPYRIGHT π
1998-2026 π
and that's the whole page, bestie π
go forth and reorder some bands, --overwrite responsibly
GDAL-RASTER-SELECT(1) Β· GDAL Β· dropped Aug 18, 2026 β ily, drink water, --band wisely πΈπβ¨
π¦ where this page comes from
- alpine 3.24: gdal-doc 3.13.3-r0 Β· MIT
- arch rolling: gdal 3.13.3-6 Β· MIT
- ubuntu stonking: gdal-bin 3.13.3+dfsg-1ubuntu4 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms