Selon Nik Sands <nix...@nixanz.com>: > My application is doing a warp using GDAL which works fine for some source > images, but with others results in an image with the colours all wrong (eg, > water areas are red instead of blue). I'm guessing that the RGB(A) (bands?) > are getting mixed up somehow, but I really don't know where to start looking > after my web searches produced nothing useful. > > The problem only occurs for some images. So far the only thing that the > problem source images have in common is that they were all converted from ECW > to GeoTIFF by 'gdal_translate' (with no options). The source GeoTIFF files > have all the correct colours before the warp. > > The code I'm using is based on the GDAL warp API tutorial and is included > below. > > I'd be grateful if somebody could point me in the right direction.
The following snippet only works for single band images. If you have presumably RGB images, you must set the nBandCount to 3 and initialize panSrcBands and panDstBands appropriately. psWarpOptions->nBandCount = 1; psWarpOptions->panSrcBands = (int *) CPLMalloc(sizeof(int) * psWarpOptions->nBandCount ); psWarpOptions->panSrcBands[0] = 1; psWarpOptions->panDstBands = (int *) CPLMalloc(sizeof(int) * psWarpOptions->nBandCount ); psWarpOptions->panDstBands[0] = 1; _______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev