Le mardi 11 octobre 2011 22:09:02, Jay Jennings a écrit : > Hi folks, > I am trying to merge a grayscale (1-band) image with RGB (3-band) imagery > using 'gdalwarp', the hope being that the grayscale image would be > converted on-the-fly to RGB by duplicating the one band 3 times, thus > ending up still grayscale visually. But 'gdalwarp' doesn't seem to do > that; instead the grayscale image comes out recognizable but dark reddish, > as if the one input band is being used as the Red band on output, with the > Green and Blue output bands getting all zeroes. > > Looking at the 'gdalwarp' documentation, I don't see any options to treat > this (admittedly unusual) case as I'm expecting. Did I miss anything ? > > ( I see that the 1-band image can be made compatible by preprocessing it > like this: gdal_translate -b 1 -b 1 -b 1 gray.tif RGB_still_gray.tif > > That will be my fallback if there are no special tricks in 'gdalwarp' )
I can understand your wish, but gdalwarp has probably already enough special tricks to justify adding a new one for which you have found by yourself a perfectly simple solution. "Write programs that do one thing and do it well." -Doug McIlroy PS: If you really want to do it in a single step, you could probably easily convince the warping algorithm to do the RGB expansion directly by setting psWO->panSrcBands[i] = 1 and assigning psWO->nBandCount to 3 . (hack in apps/gdalwarp.cpp). > ......................................................... > Jay Jennings > GeoEye, Inc. > (NASDAQ: GEOY) _______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
