GDAL-RASTER-PANSHARPEN(1)
π NAME π
gdal-raster-pansharpen β Perform a pansharpen operation
Added in version 3.12.
okay so bestie, the manual page you're reading rn is GDAL-RASTER-PANSHARPEN(1), and this is the lil glow-up of a command that takes your kinda-blurry color bands and makes them sharp using the panchromatic one. it's giving main character energy and it's literally only been around since 3.12. π
β¨ SYNOPSIS β¨
Usage: gdal raster pansharpen [OPTIONS] <INPUT> <SPECTRAL>... <OUTPUT>
Perform a pansharpen operation.
Positional arguments:
-i, --panchromatic, --input <INPUT> Input panchromatic raster dataset [required] [not available in pipelines]
--spectral <SPECTRAL> Input spectral band dataset [1.. values] [required]
-o, --output <OUTPUT> Output raster dataset [required] [not available in pipelines]
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
-r, --resampling <RESAMPLING> Resampling algorithm. RESAMPLING=nearest|bilinear|cubic|cubicspline|lanczos|average (default: cubic)
--weights <WEIGHTS> Weight for each input spectral band [may be repeated]
--nodata <NODATA> Override nodata value of input bands
--bit-depth <BIT-DEPTH> Override bit depth of input bands
--spatial-extent-adjustment <SPATIAL-EXTENT-ADJUSTMENT> Select behavior when bands have not the same extent. SPATIAL-EXTENT-ADJUSTMENT=union|intersection|none|none-without-warning (default: union)
-j, --num-threads <NUM-THREADS> Number of jobs (or ALL_CPUS) (default: ALL_CPUS)
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 pansharpen does a pan-sharpening operation. it can make you a "classic" output dataset (think GeoTIFF, slay) OR a VRT dataset that just describes the pan-sharpening operation. π«
so the way this works: you hand it a one-band panchromatic dataset plus several spectral bands, and those spectral bands are generally at a lower resolution than the panchromatic one. what comes out the other side is a multi-band dataset β with as many bands as input panchromatic bands β all enhanced up to the resolution of the panchromatic band. glow up complete, no cap. π
bestie reminder π«Ά β all bands should be in the same coordinate reference system. don't mix and match your CRSs, that's not the vibe.
more details can be found in the Pansharpened VRT section.
π¦ 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. no intermediate files, just vibes. β¨
π PROGRAM-SPECIFIC OPTIONS π
--bit-depth <val>
Specify the bit depth of the panchromatic and spectral bands (e.g. 12). If not specified, the NBITS metadata item from the panchromatic band will be used if it exists.
-i, --panchromatic, --input <INPUT>
Dataset with panchromatic band. [required] π«‘
-j, --num-threads <value>
Specify number of threads to use to do the resampling and pan-sharpening itself. Can be an integer number or ALL_CPUS (the default). more cores = more speedy, iykyk. π₯
--nodata <val>
Specify nodata value for bands. Used for the resampling and pan-sharpening computation itself. If not set, deduced from the input bands, provided they have a consistent setting.
-r, --resampling nearest|bilinear|cubic|cubicspline|lanczos|average
Select a resampling algorithm. cubic is the default.
--spatial-extent-adjustment union|intersection|none|none-without-warning
Select behavior when bands have not the same extent. See SpatialExtentAdjustment documentation in Pansharpened VRT. union is the default.
--spectral <spectral_dataset>[,band=<num>]
Dataset with one or several spectral bands. [required] π
If the band option is not specified, all bands of the dataset are taken into account. Otherwise, only the specified numth band. The same dataset can be repeated several times.
--weights <WEIGHTS>
Specify a weight for the computation of the pseudo panchromatic value. There must be as many values as input spectral bands. βοΈ
β 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 <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, 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).
translation: zero = we ate π, nonzero = something went sideways, go read the warnings bestie.
π EXAMPLES π
Example 1: With spectral bands in a single dataset
gdal raster pansharpen panchro.tif rgb.tif pansharpened_out.tif
Example 2: With a few spectral bands from a single dataset, reordered
gdal raster pansharpen panchro.tif bgr.tif,band=3 bgr.tif,band=2 bgr.tif,band=1 pansharpened_out.tif
Example 3: With spectral bands in several datasets
gdal raster pansharpen panchro.tif red.tif green.tif blue.tif pansharpened_out.tif
Example 4: Specifying weights
gdal raster pansharpen -w 0.7,0.2,0.1 panchro.tif multispectral.tif pansharpened_out.tif
Example 5: Select RGB bands from a RGBNir multispectral dataset while computing the pseudo panchromatic intensity on the 4 RGBNir bands
gdal raster pipeline read panchro.tif ! pansharpen rgbnir.tif ! select 1,2,3 ! write pansharpened_out.tif
π AUTHOR π
Even Rouault <even.rouault@spatialys.com>
π COPYRIGHT π
1998-2026
and that's the whole page bestie, we're done here π§ okay so the very last line of the original was its footer, so lemme do the cute sign-off: this lil masterpiece comes from the GDAL source, version GDAL style, tagged GDAL-RASTER-PANSHARPEN(1), dated Aug 18, 2026. obsessed. periodt. π
β¨
π¦ 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