From Open Foris Wiki

Jump to: navigation, search

Combines 2 images into one image

Usage: oft-combine-images.bash <-a first image> <-b second image> <-m first image mask> <-s second mask>


  • -a First image = Better image, whose area is used whenever possible
  • -b Second image = Image to be used elsewhere
  • -m First image mask = 0/1 mask indicating bad areas on first image with 0
  • -s Second mask = 0/1 mask indicating bad areas on second image with 0


  • Can be used to merge same-day Landsat images (adjacent) or two gapfill results (stack)
  • Takes as input the images and their masks
  • Masks for same-day can be prepared with oft-trim-mask.bash and for gapfill with oft-prepare-images-for-gapfill.bash
  • All ok areas are taken from image 1, and image 2 is used elsewhere
  • Also produces a mask that indicates ok areas of the resulting combined image with 1
  • All material needs to be in same projection
  • Works with 6 or 7 band images


cd /home/...
  • In a first step we need to adjust the nr of bands of landsat_t1.tif (7 bands) to the nr of bands of our second image (6 bands):
gdal_translate landsat_t1.tif landsat_t1_6bands.tif -b 1 -b 2 -b 3 -b 4 -b 5 -b 6
  • Then we need to prepare our mask files for each landsat image using oft-trim
oft-trim-mask.bash landsat_t2.tif
oft-trim-mask.bash landsat_t1.tif
  • Now we can run oft-combine-images.bash. The output is automatically processed, in this case it is called stack_landsat_t1_6bands_landsat_t2.tif
 oft-combine-images.bash  -a landsat_t1_6bands.tif  -b landsat_t2.tif -m landsat_t1_mask.tif -s landsat_t2_mask.tif

Back to Open Foris Toolkit Main Page

Back to Tools & Exercises

Personal tools