Mangus875

Bitmap Image file format explained

Oct 20th, 2023 (edited)
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. Bitmap image format explained
  2.  
  3. Data (Hex) Meaning Size(Bytes) Ascii Notes
  4. 41 69 00 00 FooBar 4 Hi (this says "Hi")
  5.  
  6. Header:
  7. 42 4d Signature 2 BM (always BM)
  8. 4e 00 00 00 FileSize 4 78 (in bytes)
  9. 00 00 00 00 reserved 4 unused (always 0)
  10. 36 00 00 00 DataOffset 4 54 (Offset from beginning of file to the beginning of the bitmap data)
  11.  
  12. InfoHeader:
  13. 28 00 00 00 InfoSize 4 40 (almost always 40)
  14. 08 00 00 00 Width 4 8
  15. 01 00 00 00 Height 4 1
  16. 01 00 Planes 2 1 (almost always 1)
  17. 18 00 bits/pixel 2 24 (almost always 24)
  18. 00 00 00 00 Compression 4 0
  19. 00 00 00 00 ImageSize 4 0 (0 is valid iff bits/pixel = 24)
  20. 00 00 00 00 XpixelsPerM 4 0 (rarely used)
  21. 00 00 00 00 YpixelsPerM 4 0 (rarely used)
  22. 00 00 00 00 ColsUsed 4 0 (only used if bits/pixel != 24)
  23. 00 00 00 00 ImportantCols 4 0 (only used if bits/pixel != 24)
  24.  
  25. PixelData:
  26. ff ff ff R G B [0]
  27. ff ff ff R G B [1]
  28. ff ff ff R G B [2]
  29. ff ff ff R G B [...]
  30. ff ff ff
  31. ff ff ff
  32. ff ff ff
  33. ff ff ff
  34.  
  35.  
  36.  
  37. Uncommented:
  38. 42 4d
  39. 4e 00 00 00
  40. 00 00 00 00
  41. 36 00 00 00
  42.  
  43. 28 00 00 00
  44. 08 00 00 00
  45. 01 00 00 00
  46. 01 00 18 00
  47. 00 00 00 00
  48. 00 00 00 00
  49. 00 00 00 00
  50. 00 00 00 00
  51. 00 00 00 00
  52. 00 00 00 00
  53.  
  54. ff ff ff
  55. ff ff ff
  56. ff ff ff
  57. ff ff ff
  58. ff ff ff
  59. ff ff ff
  60. ff ff ff
  61. ff ff ff
Add Comment
Please, Sign In to add comment