I have two TIFFs that have the same pixel size. One of them is geolocated inside the other. I would like to crop the larger one down to the exact same extent as the smaller one. Is this possible with a gdal command?

gdalinfo small.tif
Pixel Size = (0.100000000000000,-0.100000000000000)
Upper Left  (-13042354.590, 3866165.781) (117d 9'41.27"W, 32d46'48.73"N)
Lower Left  (-13042354.590, 3865668.981) (117d 9'41.27"W, 32d46'35.22"N)
Upper Right (-13041857.790, 3866165.781) (117d 9'25.21"W, 32d46'48.73"N)
Lower Right (-13041857.790, 3865668.981) (117d 9'25.21"W, 32d46'35.22"N)
Center      (-13042106.190, 3865917.381) (117d 9'33.24"W, 32d46'41.98"N)

gdalinfo big.tif
Pixel Size = (0.100000000000000,-0.100000000000000)
Upper Left  (-13042373.699, 3866184.891) (117d 9'41.89"W, 32d46'49.25"N)
Lower Left  (-13042373.699, 3865649.891) (117d 9'41.89"W, 32d46'34.70"N)
Upper Right (-13041838.699, 3866184.891) (117d 9'24.59"W, 32d46'49.25"N)
Lower Right (-13041838.699, 3865649.891) (117d 9'24.59"W, 32d46'34.70"N)
Center      (-13042106.199, 3865917.391) (117d 9'33.24"W, 32d46'41.98"N)
  • If I read this right then small.tif above is actually the larger one? Also I've tried to recreate rasters using the coords printed but due to precision its not exact so the rasters don't match any more. Can you give the number of cells in X and Y also? And have you tried gdal_translate with -projwin? Or does the problem also involve a) finding which is the smaller and b) extracting the coordinates to pass to -projwin?
    – Spacedman
    Commented Apr 20, 2019 at 9:25
  • Sorry, I had small.tif and big.tif swapped around. I want to cut the extend of small.tif out of big.tiff and create a new tiff. @Spacedman Commented Apr 22, 2019 at 16:42
  • This is exactly what gdal_translate -projwin does, so unless you want to automate it for any two given TIFs, cut and paste the coordinates from gdalinfo for small.tif into a gdal_translate operation on big.tif.
    – Spacedman
    Commented Apr 22, 2019 at 16:48

1 Answer 1


The gdal_translate command has a -projwin argument for selecting a window in projected coordinates:

-projwin ulx uly lrx lry

This needs upper left and lower right coordinates which you get from gdalinfo:

Upper Left  (-13042354.590, 3866165.781) (117d 9'41.27"W, 32d46'48.73"N)
Lower Right (-13041857.790, 3865668.981) (117d 9'25.21"W, 32d46'35.22"N)

So the full command would be:

gdal_translate -projwin -13042354.590 3866165.781 -13041857.790 3865668.981 big.tiff small_size_big.tiff

note the coordinates are space-separated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.