GDAL_PANSHARPEN(1)
β¨ GDAL_PANSHARPEN β¨ (that's the GDAL_PANSHARPEN(1) page bestie, from the GDAL manual π)
okay so real talk, this is the glow-up page for gdal_pansharpen and it is genuinely so useful, let's get into it π«Ά
πΈ NAME πΈ
gdal_pansharpen β do a pansharpen operation. that's it, that's the whole vibe. lowkey iconic π
π SYNOPSIS π
gdal_pansharpen [--help] [--help-general]
<pan_dataset>
<spectral_dataset>[,band=<num>] [<spectral_dataset>[,band=<num>]]...
<out_dataset>
[-of <format>] [-b <band>]... [-w <weight_val>]...
[-r {nearest|bilinear|cubic|cubicspline|lanczos|average}]
[-threads {ALL_CPUS|<number>}] [-bitdepth <val>] [-nodata <val>]
[-spat_adjust {union|intersection|none|nonewithoutwarning}]
[-co <NAME>=<VALUE>]... [-q]
like, look at her. she's got layers. she's got range. periodt. π
π DESCRIPTION π
so gdal_pansharpen performs a pan-sharpening operation bestie. it can make you a "classic" output dataset (think GeoTIFF, the standard girlies) or a VRT dataset that literally just describes the pan-sharpening operation instead of doing it. main character energy either way β¨
want the deep lore? it's in the Pansharpened VRT section. iykyk π
NOTE: π¨ gdal_pansharpen is a Python utility, and it's only available if you have the GDAL Python bindings available. no bindings, no pansharpen. tragic but true π
TIP: β¨ there's an equivalent in the new"gdal"command line interface β go look atgdal raster pansharpen. the future is now fr fr π
π¦ OPTIONS π¦
okay here's the whole lineup, no skips, no cuts, every single one:
--helpβ shows this help message and exits. bye bestie π--help-generalβ gives you a brief usage message for the generic GDAL commandline options and exits. it's the generic one, not this one, got it? π-of <format>β picks the output format. if you don't specify it, the format is guessed from the extension. use the short format name.VRTcan be used here too π-b <band>β selects band band from the input spectral bands for output. bands are numbered from 1 in the order the spectral bands are specified. you can stack multiple-bswitches. and when you use no-bswitch at all? all input spectral bands get set for output. generous queen π-w <weight_val>β sets a weight for computing the pseudo panchromatic value. heads up: there must be as many-wswitches as there are input spectral bands. count them. count them twice. no cap βοΈ-r {nearest|bilinear|cubic|cubicspline|lanczos|average}β selects the resampling algorithm.cubicis the default. she's the default for a reason β¨-threads {ALL_CPUS|<number>}β how many threads to use for the resampling and the pan-sharpening itself. can be an integer number orALL_CPUS. go fast, bestie πβοΈπ¨-bitdepth <val>β sets the bit depth of the panchromatic and spectral bands (e.g.12). if you don't specify it, theNBITSmetadata item from the panchromatic band will be used, if it exists. conditional queen π-nodata <val>β sets the nodata value for bands. it's used for the resampling and the pan-sharpening computation itself. if not set, it gets deduced from the input bands β provided they have a consistent setting. consistent or nothing, periodt π-spat_adjust {union|intersection|none|nonewithoutwarning}β picks the behavior when bands don't have the same extent. see the SpatialExtentAdjustment documentation in Pansharpened VRT.unionis the default πΈ-co <NAME>=<VALUE>β many formats have one or more optional creation options you can use to control particulars about the file being created. for instance, the GeoTIFF driver supports creation options to control compression, and whether the file should be tiled. β¨
the creation options available vary by format driver, and some simple formats have no creation options at all. you can list the options supported for a format with the --format 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 the legal creation options for each format. the docs are the blueprint, bestie π
-qβ suppresses the progress monitor and other non-error output. quiet luxury π
π§ positional args (the ones you actually have to type) π§
<pan_dataset>β the dataset with the panchromatic band. the first band will be used. one band. the first one. that's the rule π<spectral_dataset>[,band=<num>]β a dataset with one or several spectral bands. if thebandoption isn't specified, all bands of the datasets are taken into account. otherwise, only the specified (num)th band. and yes, you can repeat the same dataset several times β she's flexible like that π<out_dataset>β the output dataset. your masterpiece goes here β¨
π bands should be in the same projection. if your bands are out here living in different projections, that is not a vibe, fix it first.
β RETURN STATUS CODE β
the program returns status code 0 in case of success, and non-zero in case of error. and ngl there's a cute little asterisk here: non-blocking errors emitted as warnings are considered as a successful execution. so a warning is not a fail, bestie, breathe π«Ά
π EXAMPLE π
Example 1: With spectral bands in a single dataset
gdal_pansharpen panchro.tif multispectral.tif pansharpened_out.tif
Example 2: With a few spectral bands from a single dataset, reordered
gdal_pansharpen panchro.tif multispectral.tif,band=3 multispectral.tif,band=2 multispectral.tif,band=1 pansharpened_out.tif
(reordered and everything, she ate π₯)
Example 3: With spectral bands in several datasets
gdal_pansharpen panchro.tif band1.tif band2.tif band3.tif pansharpened_out.tif
Example 4: Specifying weights
gdal_pansharpen -w 0.7 -w 0.2 -w 0.1 panchro.tif multispectral.tif pansharpened_out.tif
Example 5: Specify RGB bands from a RGBNir multispectral dataset while computing the pseudo panchromatic intensity on the 4 RGBNir bands
gdal_pansharpen -b 1 -b 2 -b 3 panchro.tif rgbnir.tif pansharpened_out.tif
π AUTHOR π
Even Rouault <even.rouault@spatialys.com> β actual legend, we stan π«Ά
πΈ COPYRIGHT πΈ
1998-2026 π
and that's the whole page babes π GDAL manual, GDAL_PANSHARPEN(1), dated Aug 18, 2026 β go pansharpen something gorgeous for me okay? mwah π
β¨
π¦ 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