[Gdal-dev] GDALWarp Gif Problems
Frank Warmerdam
warmerdam at pobox.com
Tue Jan 23 20:46:20 EST 2007
Chris Portka wrote:
> Thanks for all your help so far. I can now "successfully" warp without
> an exception occurring. However, now when I try to actually read the
> data it is corrupted, or entirely blank (every pixel of the output file
> is black). I think I'm having a problem getting all the bands copied
> out of the raster file. I want every band from the source raster to be
> copied and transformed to the destination, is there an easy way to
> specify this? I'm also unclear on the type for the buffer I should be
> passing to WarpRegionToBuffer - I'm assuming an nPixels * nLines *
> nBands unsigned char array (the source raster is a 24-bit gif or jpg, so
> nBands gives me 3). Here's my code (I've labeled where the band code
> starts):
Chris,
The band selection logic seems ok.
> GDALWarpOperation operation;
> unsigned char *destination = (unsigned char *) new char[nPixels *
> nLines * warpOptions->nBandCount];
>
> operation.Initialize(warpOptions);
> operation.WarpRegionToBuffer(0, 0, nPixels, nLines, destination,
> GDT_Unknown);
You should be passing GDT_Byte for pixel values that are unsigned
bytes (ie. unsigned char). Hopefully this fixes things.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
More information about the Gdal-dev
mailing list