I have 2 rasters (raster1 and raster2) with 5 bands for each one. I want to do some calculation using all bands and write the output to a file with 5 bands.

I try this command :

gdal_calc.py -A raster1 -B ratser2 --outfile=result.tiff --calc="A+B" 

but it generates a wrong output file with only 1 band.


1 Answer 1


Maybe you can try:

gdal_calc.py -A raster1.tif --A_band=5 -B raster2.tif --B_band=5 --allBands=[A,B] --outfile=result.tif --calc="A+B"

Also check the following link.

  • 1
    Hi Daniel, thank you for your replay but the option --allBands=[A,B] doesn't work. This option accept only one file.
    – Sami
    Aug 15, 2018 at 13:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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