View Full Version : BMP header

March 15, 2011, 18:05:30
Good morning

I have a problem with the bmp format when i try to load an image wiht my software.
when I load an image saved with IcCapture everything work fine, but if I load an image saved with the instructions below:


My program crash with an error about the number's lines of the image.

I think the problem is the image's header.

I have compare the header of the two images, and i have found a difference. (See attachment)

On left is the wrong image (IcImgCntrl_A.MemorySaveImage("C:\img.bmp"), on right the correct(IcCapture)

The image is 1024x768 pixel, in hex 400x300 and into the header 00 04 00 and 00 03 00. Instead i have FD FF FF
I have changed the wrong byte of the header with an hexadecimal editor and the image is loading correctly.

Best regards

I'm sorry for my bad English

Michael Kirmse
March 16, 2011, 12:03:02
Hello Gima67,
is it possible to open the snapped image with any other program?

March 16, 2011, 13:17:45
No. The program is specific for my job.
I have supposed an header's error, is this right?

Or is my program wrong?

Best regards

Stefan Geissler
March 16, 2011, 14:48:58

negative heights are specified in bitmap headers. They determine, whether the bitmap is top down or bottom up. If your program can not read this, then your program is wrong at this point.

However, you may try

IcImgCntrl_A.ImageActiveBuffer.Bitmap.Save("C:\img.bmp", System.Drawing.Imaging.ImageFormat.Bmp);

March 16, 2011, 15:17:37
with the instruction

IcImgCntrl_A.ImageActiveBuffer.Bitmap.Save("C:\img.bmp", system.Drawing.Imaging.ImageFormat.Bmp)

now work fine.

Thank you.