PDA

View Full Version : Creating bitmap (bmp) buffer



Ikarus
September 19, 2011, 10:27:10
Hi
I would like to create out of a MemBuffer (RGB8) a bmp buffer without saving the data first to a file. Is this possible with the c++ lib?.

Thanks for answers.

Stefan Geissler
September 19, 2011, 10:32:05
Hello,

a BMP is a file format with header and image data. Therefore, I do not understand your question. The image data is as stream of bytes available. Also you can get the BITMAPINFOHEADER from the buffer.
Please refer to:
http://www.imagingcontrol.com/en_US/support/documentation/class/meth_descMemBuffer_getBitmapInfoHeader.htm

and
http://www.imagingcontrol.com/en_US/support/documentation/class/meth_descIFrame_getPtr.htm

The MemBuffer is inherited from IFrame, therefore the method getPtr() will return the pointer to the image data of the MemBuffer.

Ikarus
September 19, 2011, 10:51:52
Sorry for my less informations.
Yes, I know all the stuff with BITMAPINFOHEADER and the MemBuffer.
But if I have a FrameHandlerSink initialized with RGB8 and I build an image-buffer with BITMAPFILEHEADER + BITMAPINFOHEADER (from getBitmapInfoHeader) + Imagedata (out of the MemBuffer) my "BMP"-Buffer seems not to be valid. With RGB32 all works fine.
Thanks.

Ikarus
September 19, 2011, 12:01:32
It seems that the RGB8 imagedata will be saved with another bmp-header as the RGB32.
Is there a function where I can get a completely generated bmp-buffer like a saveToMemoryBMP or something else?

Thanks for your answere.

Stefan Geissler
September 19, 2011, 15:46:48
Hello

As far as I know, RGB 8 uses a color palette with 256 RGB values for the colors. The content of the bytes in the memory returned by getPtr are only indexes to this palette. However, the contents is 1,1,1,2,2,2,3,3,3,4,4,4 and so on. Maybe you forgot to create this.


Is there a function where I can get a completely generated bmp-buffer like a saveToMemoryBMP or something else?
Usually this is not necessary, therefore we did not foresee such a function.

Ikarus
September 19, 2011, 17:23:18
Yes, I forgot to initialize the color-palette.
Thank you for your help!