GDAL-RASTER-COMPARE(1)
β¨ gdal-raster-compare β bestie edition β¨
okay so this is gdal-raster-compare from the GDAL manual (section 1, periodt), and it's here to help you compare two raster dataset π
Added in version 3.12. π
π SYNOPSIS π
Usage: gdal raster compare [OPTIONS] <REFERENCE> <INPUT>
Compare two raster datasets.
Positional arguments:
--reference <REFERENCE> Reference dataset [required]
-i, --input <INPUT> Input 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:
--skip-all-optional Skip all optional comparisons
--skip-binary Skip binary file comparison
--skip-crs Skip CRS comparison
--skip-geotransform Skip geotransform comparison
--skip-overview Skip overview comparison
--skip-metadata Skip metadata comparison
--skip-rpc Skip RPC metadata comparison
--skip-geolocation Skip Geolocation metadata comparison
--skip-subdataset Skip subdataset comparison
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 compare is literally the friend who sits down, looks at two GDAL-supported datasets, and tells you exactly what's different between them. π«Ά And not just a vibe β it reports the differences to standard output, and it hands you back the difference count in its exit value. iykyk.
So here's the social contract, bestie: the first dataset β the one you pass as the first positional argument or through --reference β is the reference slash exact slash golden dataset. The second dataset β first as second positional argument, or through --input β is the one being compared to the reference. That's the hierarchy, and we respect it. β¨
What actually gets checked? Image pixels, and a whole bunch of metadata. π§ There's also a byte by byte comparison happening, and if that one fails it counts as one difference. So listen: if the only thing you care about is that the GDAL visible data is identical, then a difference count of 1 (that's the binary difference, girly) should be considered acceptable. Or you can just pass --skip-binary and skip the byte to byte comparison entirely. your call, main character π
Also iconic: this program can be used as the last step of a raster pipeline. πΈ
The following options are available:
π PROGRAM-SPECIFIC OPTIONS π
--input<input-dataset> β the dataset being compared to the reference dataset. We call it the input dataset. π--reference<reference-dataset> β the dataset that is considered correct. We call it the reference dataset. π--skip-all-optionalβ whether to skip all optional tests. This is an alias to defining all the other--skip-XXXXoptions. So like, one flag and you've skipped the whole optional syllabus. π
The remaining non-optional tests are:
- checking dataset width, height and band count
- checking band description, data type, color interpretation and nodata value
- checking pixel content
--skip-binaryβ whether to skip exact comparison of binary content.--skip-crsβ whether to skip comparison of coordinate reference systems (CRS).--skip-geolocationβ whether to skip comparison of GEOLOCATION metadata domain.--skip-geotransformβ whether to skip comparison of geotransform matrix.--skip-metadataβ whether to skip comparison of metadata--skip-overviewβ whether to skip comparison of overviews.--skip-rpcβ whether to skip comparison of Rational Polynomial Coefficients (RPC) metadata domain.--skip-subdatasetβ whether to ignore comparison of all subdatasets that are part of the dataset.
β STANDARD OPTIONS β
--if,--input-format<format> β the format/driver name to be attempted to open the input file(s). ngl it's generally not necessary to specify it, but you can use it 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.
π₯ 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, don't panic, bestie. π«Ά)
π¦ EXAMPLES π¦
Example 1: Comparing two datasets that differ by their data types
$ gdal raster compare autotest/gcore/data/byte.tif autotest/gcore/data/uint16.tif
Reference file has size 736 bytes, whereas input file has size 1136 bytes.
Reference band 1 has data type Byte, but input band has data type UInt16
$ echo $?
2
Example 2: Comparing two datasets while values have different units
$ gdal raster pipeline read test_in_foot.tif ! calc --calc "X * 0.3048" ! compare --reference=reference_in_meter.tif
π AUTHOR π
Even Rouault <even.rouault@spatialys.com> β the icon, the legend, the moment. π
π COPYRIGHT π
1998-2026
and that's the whole page, no cap. π this was GDAL-RASTER-COMPARE(1) from the GDAL manual, dated Aug 18, 2026 β go forth and compare those rasters, you absolute queen πβ¨π
π¦ 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