I first ran xxd -c 36 -g 3 large.bmp and got the underlying binary file. For this question, I will reproduce the first line (36 bytes)

424de6 010000 000000 003600 000028 000000 0c0000 00f4ff ffff01 001800 000000 00b001

1) First two bytes are 424d which represent'B''M' magic chars--Got it!

2) Next four bytes should be bfsize or size in bytes of the complete bmp file.This should be 486 bytes However binary file represents e6010000 (4 byte unsigned int DWORD) which in decimal is 3858825216 and not 486.Why?

3) Next field I checked was biWidth,long type, with offset 18. In theabove line that would be 0c000000 or 201326592 in decimal. Why?

4) Next field was biHeight with long type and offset 22. In the above binary line that would be f4ffffff or -184549377?...

May be I dont understand what byte offset means

1 Answer 1


Bytes inside the fields are the other way around. Citing Wikipedia on BMP format:

All of the integer values are stored in little-endian format (i.e. least-significant byte first).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .