Weird hex numbers in BMP file

797 Views Asked by At

I have a weird thing in BMP GRAPHICS files.

I create them with FULLSHOT 9 (screen capture software) (just mouse click+drag a rectangle on the screen and save as .bmp FILE).

When i watch the file in the binary editor, i can see a pixel being use for a loooong time as expected.

So you see something like this:

(editor shows 8 hex numbers per row)(Pixel = 3 hex numbers like "ED ED ED")

0x00002f0 <---- some offset from start of file (long past header part of bmp file, after which i only expect a long sequence of pixels, not some extra information)

ED  ED  ED  ED  ED  ED  ED  ED
ED  ED  ED  ED  ED  ED  ED  ED
ED  ED  ED  ED  ED  ED  ED  ED
ED  ED  ED  ED  ED  ED  ED  ED

But then suddenly you see a block of regular (like Pixel = 3 hex numbers) but not repeating numbers

EF  EF  EF
F0  F0  F0
F2  F2  F2
F3  F3  F3
F5  F5  F5
F7  F7  F7
F8  F8  F8
FA  FA  FA
FB  FB  FB
FD  FD  FD

(i made the newline after each group of 3 for clarity.... the binary editor shows 8 hex numbers in a row)

i suspect these are not actual pixels but some "information" Then often you see a weird 0 alone.

00  <----i suspect a terminator of some sort.

then the "information" part continues...

but now (most of the time) in reverse order
FD  FD  FD
FB  FB  FB
FA  FA  FA ..etc

and stops, and a new looooong repetition of pixels.

DC  DC  DC  DC  DC  DC  DC  DC  
DC  DC  DC  DC  DC  DC  DC  DC  
DC  DC  DC  DC  DC  DC  DC  DC  
DC  DC  DC  DC  DC  DC  DC  DC  
DC  DC  DC  DC  DC  DC  DC  DC  

PROBLEM: These blocks of "information" disturb me from collecting all the actual pixels. If i knew what they were, i could tell the program to skip them.

QUESTION 1: What could the meaning of this "information" part be?

QUESTION 2: Is the zero really a terminator?

PS I have measured the difference between the reoccurring zero's and it usually is a multiple of "with of the bitmap" in different .bmp files i created and examined.

1

There are 1 best solutions below

0
On

All the information you need is at Wikipedia on the BMP Format.

0x00002f0 <---- some offset from start of file (long past header part of bmp file, after which i only expect a long sequence of pixels, not some extra information)

You don't mention at what position you find this value, but that is probably the start of the raw pixel data:

Bitmap File Header

..

000Ah 4 bytes the offset, i.e. starting address, of the byte where the bitmap image data (pixel array) can be found.

Q1. The "information" is, from the looks of it, just a palette. It is not required for a true color bitmap to contain an explicit palette, but then again it may have one. Theoretically, this would be an optimized 8-bit palette for the same image, but I wouldn't count on it. The part you show is a simple list of grays.

Q2. Those zeroes may be DWORD line padding. They occur at "multiples of bitmap width", because each line in your image occupies, in fact, a "multiple of the bitmap width" bytes -- 3 times for RGB, 4 times for RGBA. Only at the end of the line, zeroes are inserted to make sure the next line starts at a DWORD boundary.