Showing results for 
Search instead for 
Do you mean 

Pulling out single-band images from a multi-band image.

by Technical Evangelist on ‎03-16-2016 10:41 AM - edited on ‎10-31-2019 02:30 AM by Community Manager (4,585 Views)


How to split a multi-band image into a series of single-band images?


For example, one multispectral image has 220 bands. I want to obtain 220 Images with 1 band.


Image number "1" contains band 1 of multispectral image.
Image number "2" contains band 2 of multispectral image.
Image number "220" contains band 220 of multispectral image.


Note: This article applies to IMAGINE versions 16.00 or lower. IMAGINE version 16.01 uses a different model that this article does not appy to. A model is attached to this article that has comparable functionality and runs with IMAGINE versions 16.00 and 16.01 (but not with IMAGINE version 15.00).


First, create the text file that contains a list with the full path and filename of the input image along with a single band number on each line. The filename and band number must be separated by a single space and a single space must be added to the end of each line. An example of how your text file will look is provided below:


e:/docs/batch_kb/germtm.img 1

e:/docs/batch_kb/germtm.img 2

e:/docs/batch_kb/germtm.img 3

e:/docs/batch_kb/germtm.img 4

e:/docs/batch_kb/germtm.img 5

e:/docs/batch_kb/germtm.img 6


1. ERDAS IMAGINE Raster tab > Geometry group > Subset & Chip > Create Subset Image

2. Select the input file (germtm.img).

3. Choose a location and a root name (e.g. __band.img ) for the output image files.

4. Enter “1” in the Select Layers field.

5. Choose the Batch button to launch the Batch Command Editor.





6. From the Variables: pulldown menu, select One or more inputs, one output.


The command should now look this:

modeler -nq subset.pmdl -meter -state "$(Input)" Integer 1 "$(Output)" Unsigned_8_bit Integer '$(Input.Ulx)' '$(Input.Uly)' '$(Input.Lrx)' '$(Input.Lry)' Map useall Continuous "Continuous" "Continuous" "None" '' '' ''





7. Select the Edit button. From the Variable Editor dialogue, click the Add button. Rename the NEW VARIABLE to Input2.





8. Select the variable named Output1. Edit the Pattern line and insert $(Input2) after $(Input1.root). The new pattern line should read like this: e:/docs/batch_kb/$(Input1.pathright)$(Input2)___band.img. Then click Close.





9. The new variable Input2 is added to the Variable Values list. Edit the command line and replace the value 1 (after Integer) with $(Input2).


The command should now look like this:

modeler -nq subset.pmdl -meter -state "$(Input1)" Integer $(Input2) "$(Output1)" Unsigned_8_bit Integer '$(Input1.Ulx)' '$(Input1.Uly)' '$(Input1.Lrx)' '$(Input1.Lry)' Map useall Continuous "Continuous" "Continuous" "None" '' '' ''





10. From the Variable Values list, select both Input1 and Input2 with the mouse pointer. Right-click on the Input2 column heading and select Import





11. Enter the name of the text file created in the first step into the Import from (*.txt) window. Select Space from the Separator Character pulldown menu. Then click OK.





12. The Variable Values list will be populated with the image names and band number values. Click Run Now to begin processing the data.






on ‎11-04-2016 06:58 AM

The op button to change the variable option is grayed out in IMAGINE 2016.1Untitled.jpg


How can one proceed to edit the command?


Thanks in advance

by Technical Evangelist
on ‎11-07-2016 12:17 PM

Working on an updated document. Should be available shortly.



on ‎11-08-2016 02:07 AM

Hi Jeff


Thanks, I look foward to recieving the complete workflow


Kind Regards

by Technical Evangelist
on ‎11-08-2016 09:14 AM

The article is updated but now it only applies to versions 16.00 or lower. The Subset function was changed from legacy modeler .pmdl to Spatial Modeler .gmdx in 16.01.


Original Command is grayed out because spatial model commands are variablised when they are submitted to the batch editor. The batch command can still be edited. Spatial Modeler has the internal functionality to iterate through the multiple bands inside of the model without using batch. Building a Spatial Model could be just as simple or easier than variablising the Subset batch command.

by Technical Evangelist
on ‎11-09-2016 06:37 AM

Unexpectedly, the revised document doesn't apply to 16.01 without additional modification. I'm looking for a better 16.01 solution for this example.