BMPThis is a page for BMP file analysis (Header). Try sample file: Try an example
What are we looking for?For a BMP file, we look for the byte sequence 42 4D or the ASCII sequence of BM |
File contents analysisByte 1,2 should be [0x4D 0x42]: 424D File signature analysis (Header analysis)BMP file (Starts with 0x42 0x4D)Additional scanning signature analysisPossible: [ICO file, sig: 00000100] Count: 1 File hex characters[00000000] 42 4D 66 B4 00 00 00 00 00 00 36 00 00 00 28 00 BMf.......6...(. Base-64 conversionQk1mtAAAAAAAADYAAAAoAAAAfAAAAHwAAAABABgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
Sample code
public string getBmp(System.IO.Stream file) { string TextBox1 = ""; byte[] b = ReadFully(file, file.Length); TextBox1 += "Byte 1,2 should be [0x4D 0x42]: " + Global.intToHex(b[0]) + Global.intToHex(b[1]) + "<br/>"; TextBox1 += "Bytes 3-6 (Images Size) " + Global.intToHex(b[5]) + Global.intToHex(b[4]) + Global.intToHex(b[3]) + Global.intToHex(b[2]) + "<br/>"; TextBox1 += "Bytes 7,8 (Must be zero) " + Global.intToHex(b[6]) + Global.intToHex(b[7]) + "<br/>"; TextBox1 += "Bytes 9,10 (Must be zero) " + Global.intToHex(b[8]) + Global.intToHex(b[9]) + "<br/>"; TextBox1 += "Bytes 11-14 (Image offset) " + Global.intToHex(b[13]) + Global.intToHex(b[12]) + Global.intToHex(b[11]) + Global.intToHex(b[10]) + "<br/>"; TextBox1 += "Bytes 15-18 (size of BITMAPINFOHEADER structure, must be 40 [0x28]) " + Global.intToHex(b[17]) + Global.intToHex(b[16]) + Global.intToHex(b[15]) + Global.intToHex(b[14]) + "<br/>"; TextBox1 += "Bytes 19-22 (image width) " + Global.intToHex(b[21]) + Global.intToHex(b[20]) + Global.intToHex(b[19]) + Global.intToHex(b[18]) + "<br/>"; TextBox1 += "Bytes 23-26 (image height) " + Global.intToHex(b[25]) + Global.intToHex(b[24]) + Global.intToHex(b[23]) + Global.intToHex(b[22]) + "<br/>"; TextBox1 += "Bytes 27,28 (number of planes in the image, must be 1) " + Global.intToHex(b[27]) + Global.intToHex(b[26]) + "<br/>"; TextBox1 += "Bytes 29,30 (number of bits per pixel (1, 4, 8, or 24 [0x18])) " + Global.intToHex(b[29]) + Global.intToHex(b[28]) + "<br/>"; TextBox1 += " -- Note 24 bit color, is three bytes of red, green and blue, each<br/>"; return (TextBox1); }