I recently opened 2 identical bitmap images in Notepad++ The one header begins with:
'Bmb' and the other with: 'Bm~'
Why is that?
This is not the entire header - and actually it's one and a half field from the header.
Here's the header format from Wikipedia:
Offset dec | Size | Purpose |
---|---|---|
0 | 2 bytes | The header field used to identify the BMP and DIB file is 0x42 0x4D in hexadecimal, same as BM in ASCII. The following entries are possible: - BM - Windows 3.1x, 95, NT, ... etc.- BA - OS/2 struct bitmap array- CI - OS/2 struct color icon- CP - OS/2 const color pointer- IC - OS/2 struct icon- PT - OS/2 pointer |
2 | 4 bytes | The size of the BMP file in bytes |
6 | 2 bytes | Reserved; actual value depends on the application that creates the image, if created manually can be 0 |
8 | 2 bytes | Reserved; actual value depends on the application that creates the image, if created manually can be 0 |
10 | 4 bytes | The offset, i.e. starting address, of the byte where the bitmap image data (pixel array) can be found. |
BM
is the value of the first field. The third "character" is actually the first byte from the second field (size of the BMP in bytes) incorrectly interpreted as text.
Because the header is neither Bmb nor Bm~. It is BM. Your bitmaps were not identical after all.
This is specified in the BITMAPFILEHEADER structure: “The file type; must be BM.”
In the Header, the first 2 Bytes must be "BM" which is what you got.
The next 4 Bytes store the size of the file , which , by co-incidence , in your case , looks like "P" or "~".
You can try to take the raw Bytes in the 4 locations & Calculate the file size. It should match the file size on Disk.
Alternately, use Image Tools to Process the Header & extract the file size & then compare.