GDALCOMPARE(1)
β¨ NAME β¨
okay so, bestie, welcome to the GDAL manual π this here is the page for GDALCOMPARE(1) β and it does exactly one iconic thing: compare two images π¦
πΈ SYNOPSIS πΈ
gdalcompare [--help] [--help-general]
[-dumpdiffs] [-skip_binary] [-skip_overviews]
[-skip_geolocation] [-skip_geotransform]
[-skip_metadata] [-skip_rpc] [-skip_srs]
[-sds] <golden_file> <new_file>
π DESCRIPTION π
gdalcompare takes two datasets that GDAL supports, compares them, and reports the differences. And listen β it does not just yap at you on standard output. It also returns the difference count in its exit value. main character behaviour, honestly π
So what's getting checked? Image pixels, for sure, plus a whole bunch of metadata. And there's a byte-by-byte comparison happening too, which counts as one difference all on its own. So if the only thing you care about is that the data GDAL sees is identical, then a difference count of 1 β that one binary difference β should be considered totally acceptable. periodt π―
NOTE: gdalcompare is a Python utility, and it's only available if the GDAL Python bindings are available. no bindings, no vibes π
--help β show this help message and exit, easy peasy π
--help-general β gives you a brief usage message for the generic GDAL commandline options, and then exits. the generic options, not the slay-specific ones π«
β¨ the flags β¨
-dumpdiffsβ Added in version 3.8. Whether to output the difference in pixel content in a TIFF file in the current directory. yes bestie it literally writes you a whole TIFF of the diffs π-skip_binaryβ Added in version 3.8. Whether to skip exact comparison of binary content. skipping the byte-by-byte, no problem π«Ά-skip_overviewsβ Added in version 3.8. Whether to skip comparison of overviews. leave those overviews alone π-skip_geolocationβ Added in version 3.8. Whether to skip comparison ofGEOLOCATIONmetadata domain. not today, geolocation π-skip_geotransformβ Added in version 3.8. Whether to skip comparison of the geotransform matrix. matrices? never met her β¨-skip_metadataβ Added in version 3.8. Whether to skip comparison of metadata. metadata who? don't know her π-skip_rpcβ Added in version 3.8. Whether to skip comparison of the Rational Polynomial Coefficients (RPC) metadata domain. rational polynomial coefficients, you are safe from this comparison π-skip_srsβ Added in version 3.8. Whether to skip comparison of spatial reference systems (SRS). srs, we're ignoring you today bestie π-sdsβ if you pass this flag, the script compares all subdatasets that are part of the dataset. if you don't pass it, subdatasets are ignored. that's it, that's the deal π¦
π₯Ί the arguments
<golden_file>β the file that is considered correct. this one is referred to as the golden file. it's the reference, the blueprint, the moment π<new_file>β the file being compared to the golden file. this one is referred to as the new file. the challenger, if you will π₯
okay and here's the part that makes me feral in a good way: the gdalcompare script β like all the other scripts, no cap β can also be called as a library from Python code:
from osgeo_utils import gdalcompare
The primary entry point is gdalcompare.compare_db(), which takes a golden gdal.Dataset and a new gdal.Dataset as its arguments and returns a difference count (excluding the binary comparison). And there's gdalcompare.compare_sds(), which you can use to compare subdatasets. library girly behaviour, we LOVE to see it ππ
π― RETURN STATUS CODE π―
The program returns status code 0 when it succeeds, and non-zero when there's an error. Important lil caveat: non-blocking errors that get emitted as warnings are still considered a successful execution. so a warning is not a fail, she's just talking π
π EXAMPLES π
Exhibit one, where things do not match:
gdalcompare -dumpdiffs N.tiff S.tiff; echo $?
Files differ at the binary level.
Band 1 checksum difference:
Golden: 36694
New: 40645
Pixels Differing: 1509
Maximum Pixel Difference: 255.0
Wrote Diffs to: 1.tif
Differences Found: 2
2
Exhibit two, where a file is compared to its literal self and the vibe check is passed flawlessly:
gdalcompare N.tiff N.tiff; echo $?
Differences Found: 0
0
π«Ά AUTHOR π«Ά
Frank Warmerdam <warmerdam@pobox.com>
π COPYRIGHT π
1998-2026
and that's the whole page, bestie!! you ate this entire manual π
this was GDAL's GDALCOMPARE(1), dated Aug 18, 2026 β go forth and compare responsibly, 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