I have created thousands of png tiles using ArcGIS and have merged groups of them into large jp2 files for serving via GeoServer. I need to flatten these to a single band so that I can apply a colour map to achieve transparency.

Merge single band and multi band color images is similar but the suggested tool "Composite Bands tool in arctoolbox" only merges single band to 3 band. I need the reverse!

This is based on the following question Getting a constant background color for transparency

I have arcgis 10.1, qgis/gdal, erdas imagine and global mapper.

1 Answer 1


QGIS: Use the Raster Calculator to average the three bands (with a "+1" so you don't get a divide by 0 error); you can do more advanced averaging if you want of course:

(raster_name@1 + raster_name@2 + raster_name@3 + 1) / 3

This results in a single band output. It supports all output formats that QGIS does, I don't see JP2 on the list, but I didn't look that hard.

ArcGIS: Same premise as QGIS; you'll need the Spatial Analyst Extension to get the Raster Calculator. Looking at it though, ArcGIS doesn't make it as easy to get access to bands via the calculator (its poorly documented, but see here: http://forums.arcgis.com/threads/35761-ArcGIS-10-selecting-attributes-from-multiple-bands )

In ArcGIS 10 Raster Catalog, use full catalog path names instead of layer names in the expression.

(("C:\Test\KALI-1415.jpg\Band_1") <= 50) & (("C:\Test\KALI-1415.jpg\Band_2") >= 120) & (("C:\Test\KALI-1415.jpg\Band_3") <= 173)

*KALI-1415.jpg is my example image.

FME: You didn't ask for this one, but as its available under a free evaluation license. Easy to do, can also do all of the mosaicing and stuff but I guess you've done that. Its either RasterInterpretationCoercer or RasterBandInterpretationCoercer.

  • Thanks...the QGIS works great. I don't have enough spatial analyst extensions to use ArcGIS or FME which is unfortunate as QGIS can't output jp2 and the process seems to blow the image size from ~500mb to ~3GB. The other issue is how can I get the same color palette as the input 3band into the 1band as a color map?
    – GeorgeC
    Oct 31, 2012 at 12:40
  • @GeorgeC The QGIS file size thing is probably because its creating more columns/rows than the original. Be sure to set the correct number. If you export to something lossless then use gdal or whatever to convert it, that'll work. Afraid I don't know about palettes or color maps, sorry. Oct 31, 2012 at 12:46
  • They both have the same number of columns but there is such a big increase in size. If I reduce the number of columns is there a formula to figure out how much to change it by?
    – GeorgeC
    Oct 31, 2012 at 13:27
  • @GeorgeC - Use the row/column count from the original data. On further experimentation, I suspect it may also be because your new data is a 32bit band (don't know how to change that in QGIS or ArcGIS). Plus the new data may not be compressed. Oct 31, 2012 at 16:08

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.