[Gdal-dev] CreateCopy into buffer

Charles Wivell charles.wivell at dnr.state.mn.us
Thu Dec 1 12:28:53 EST 2005


Hi Ivan;

The .bmp format is a very simple format. It has a simple header and the image is stored as BIP. If I remember right each pixel is stored as (BGR) and depending on version of .bmp, the last line of the image in the BIP buffer is the first line of the image displayed or the first line of the BIP buffer is the first line of the image.

Anyway, once the large image is in the memory buffers, you can use "for" loops to copy from the large image buffers into the windowed image buffers and then create the bitmap file (write out the header and create a BIP buffer and write it out) or if you are using MS VC++ you can use the GDI+ libraries to create a bitmap directly from the windowed buffers and save the image.

Chuck Wivell



>>> Frank Warmerdam <warmerdam at pobox.com> 12/01/05 9:54 AM >>>
On 11/29/05, Ivan Mjartan <ivan.mjartan at geovap.cz> wrote:
>
> Hi list,
>
>
>
> I am writing function in C++ witch on input get large raster and return
> small sub window of the input raster in BitMap (*.BMP file). The sub window
> is never larger then 1000*1000px.

Ivan,

I think you should read over:

  http://www.gdal.org/cpl__vsi_8h.html#de6f5d790c7eabeae5b25f8ad4540503 

I don't think the appropriate functions are currently exported via SWIG,
so currently you may not be able to do this.  But it shouldn't bee to
hard to add the VSIGetMemFileBuffer() and VSIFileFromMemBuffer()
functions to the swig lists.

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

_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org 
http://lists.maptools.org/mailman/listinfo/gdal-dev





More information about the Gdal-dev mailing list