I have a .tif file with 61 bands. Normally, to save a band, I use the rastar calculator expression filename@1. But since there are 61 bands, with each band corresponding to a date, from April 1 to May 31, is there a way to export all the 61 bands into 61 .tif files, like running it as a batch process?

1 Answer 1


Easy solution: Rearrange bands

Easier than the raster calculator for your task is the algorithm Rearrange bands.

  1. Run it from Menu Processing -> Toolbox in batch mode (old docu, doesn't show all options).

  2. Add bands 1 to 61: in the second column Selected band(s), click Autofill -> Add values by Expression, then enter the expression: generate_series (1,61). This automatically adds 61 lines (bands 1 to 61).

  3. In the first line, fill in the values for Input layer and Converted (path/filename). Then copy these values to the remaining 60 lines with Autofill... -> Fill down. Run it and you're done.

enter image description here

Generate filenames with the date represented in the raster band

When you save the rasters, you might want to automatically name the resulting files with the date that each band respresents. As long as there is a logical pattern between band no. and date, you can also use Autofill... -> Add values by expression. The following expression shows how to generate a filename where band no. 1 is april 1st 2024; band 2 is april 2nd etc.:

    'C:/Users/your_path/'  ||  -- replace with your path
    to_date ('2024-04-01','yyyy-MM-dd') + 
    to_interval (@element || ' day') || 

Filenames generated automatically: enter image description here

Variant: Raster Calculator

You could still do it with the raster calculator.

  1. Open the `Raster Calculator from Menu Processing -> Toolbox: then you have a button to run it in batch mode.

  2. Second column Expression, use Autofill -> Add values by Expression and enter this expression

    be sure you have the single ' and double quotes " exactly as below:

        generate_series (1, 61),
        '"filename@'  ||  @element  || '"'
  3. Fill in the first row of the other settings accordingly as in the first solution.

enter image description here

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.