[Gdal-dev] How to save picture into bmp-file?

Frank Warmerdam warmerdam at pobox.com
Wed Sep 2 09:27:05 EDT 2009

ryabis wrote:
> Sorry, but I`m just started to use C++ and GDAL library... :thinking:
> I have opened the image, using this code:


> 	    poBand_1->RasterIO( GF_Read, x_off, y_off, xsize, ysize, pafScanline,
> xsize, ysize, GDT_Byte, 1, xsize );


>     if (poBand->RasterIO( GF_Write, 0, 0, 512, 512, abyRaster, 512, 512,
> GDT_Byte, 0, 0 ) == CE_Failure) 
> What should I write instead of abyRaster?


You would presumably need to read the region from the source file as you
did above for one band images into pafScanline, and then write that
same buffer into the output file in plcae of abyRaster.

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    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list