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 (3,424 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.






by Nizza
on ‎11-10-2016 06:23 AM

Thanks Jeff


Greatly appreciated 

by Technical Evangelist
‎11-10-2016 12:27 PM - edited ‎11-10-2016 12:28 PM

I posted a full section of screenshots and model explanations. Not sure what happened to it? Will try to repost. In the meantime, I attached the model to the original article. Please take a look at it.




by Technical Evangelist
on ‎11-11-2016 08:13 AM

This model solution copies a single layer from a multilayer raster image to a new single layer raster image. The simplified version below requires that you run it multiple times, once for each band that you need to write out. The input raster name, the band used for the subset, and the output raster name must be specified.







The more efficient model solution would take advantage of the Spatial Modeler Iterator operator introduced in ERDAS IMAGINE 2016. The Iterator operator enables a sub-model to be executed n times, the number n being controlled by the length of an input list. The baseline model remains simple but automating the assignment of meaningful unique output filenames has to be carefully constructed.


The collapsed model view below shows the Multilayer raster input and a Layer_Number submodel that distributes the output layer assignment to the Iterator Model.





The Layer_Number Submodel reads and routes the number of layers from the multilayer raster to a table of layer numbers that is read by the Iterator model.





The Iterator operator copies each band from the multiraster raster to a single layer raster with a unique filename. Using string operators, the input layer number (_n) is concatenated to root raster name (germtm), which is concatenated by a descriptor name and filename extension (_unstacked.img), ending with the Filename germtm_n_unstackstack.img.





For more info on the Iterator operator visit the Community Spatial Recipes site:

Zonal Mean Iterator 2016


The model 'unstack_names.gmdx' is attached to the first article.