I am interested in looping through a directory and listing only the red bands (Band 1) from 4-band NAIP imagery. From there I would like to mosaic all of the band 1 layers into a new single band raster image using Mosaic to New Raster. Is there a way to specify band 1 using arcpy.ListRasters() or should I find a new approach?

  • Switch to GDAL first. Commented Oct 24, 2013 at 12:31

1 Answer 1


Try this:

import os
import arcpy
bands = []
arcpy.env.workspace = #Set path to dir
for r in arcpy.ListRasters():
    rObject = arcpy.Describe(r)
    band1 = os.path.join(rObject.catalogPath,"bandx") #bandx = name of band to extract
    #outR = # full path to output raster

#do mosaic here outside loop.

The Composite Bands tool allows you to pull out bands from a multi band image.

  • 1
    +1 Excellent script help here--thanks. Do you know if there is any way to bypass generating Composite Bands and pass a band1 list directly to Mosaic to New Raster?
    – Aaron
    Commented Jul 25, 2013 at 20:25
  • 1
    @Aaron - instead of appending outR to the bands list, append band1 - this should give you a list of all Band1s, which you should be able to pass to the mosaic tool.
    – Nxaunxau
    Commented Jul 25, 2013 at 21:07

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.