GDAL-RASTER-PANSHARPEN(1)

NAME
gdal-raster-pansharpen - Perform a pansharpen operation

Added in version 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]
      --spectral <SPECTRAL>                                    Input spectral band dataset [1.. values] [required]
      -o, --output <OUTPUT>                                    Output raster dataset [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)
    Options:
      -f, --of, --format, --output-format <OUTPUT-FORMAT>      Output format ("GDALG" allowed)
      --co, --creation-option <KEY>=<VALUE>                    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
      -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]
      --oo, --open-option <KEY>=<VALUE>                        Open options [may be repeated]

DESCRIPTION

gdal raster pansharpen performs a pan-sharpening operation. It can create a "classic" output dataset (such as GeoTIFF), or a VRT dataset describing the pan-sharpening operation.

It takes as input a one-band panchromatic dataset and several spectral bands, generally at a lower resolution than the panchromatic band. The output is a multi-band dataset (with as many bands as input panchromatic bands), enhanced at the resolution of the panchromatic band.

All bands should be in the same coordinate reference system.

More details can be found in the Pansharpened VRT section.

OPTIONS

The following options are available:

-i, --panchromatic, --input <INPUT>
    Dataset with panchromatic band. [required]

--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 (num)th band. The same dataset can be repeated several times.

-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

--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.

--overwrite
    Allow program to overwrite existing target file or dataset. Otherwise, by default, gdal errors out if the target file or dataset already exists.

--weights <WEIGHTS>
    Specify a weight for the computation of the pseudo panchromatic value. There must be as many values as input spectral bands.

-r, --resampling nearest|bilinear|cubic|cubicspline|lanczos|average
    Select a resampling algorithm. cubic is the default.

--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.

--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.

--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.

-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)

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: 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