下面是位图中的十六进制数据
424D 46000000 0000 0000 0000 3E000000 28000000 02000000 02000000 0100 0100 0100 00000000000000000000000000000000000000000000000000000000000000000000000000000000来不通000000000000000000000000000000000000000000000000000000 000000000000来
我需要了解所有值代表什么,尤其是像素值。这是一个用 mspaint 保存的位图,它是一个单色位图。以下是我的理解/误解...其中大部分是您从 wiki 和搜索 bmp 获得的信息。这只是我试图分解我的 bmp,它在顶部有两个黑色像素,在底部有两个白色像素。
42 4d is BM
46 00 00 00 size of entire file
00 00 reserved 1
00 00 reserved 2
3e 00 00 00 offset to where pixel data can be found
28 00 00 00 # of bytes in this header
02 00 00 00 width of bmp
02 00 00 00 height of bmp
01 00 # of planes
01 00 # of bits per pixel
00 00 00 00 compression
08 00 00 00 size of raw data in pixel array in bytes
00 00 00 00 horizontal resolution pix/m
00 00 00 00 vertical resolution pix/m
00 00 00 00 number of colors
00 00 00 00 important colors
00 00 00 00 x=1 y=2 pixel value? is supposed to be white
ff ff ff 00 x=2 y=2 pixel value? is supposed to be white
c0 00 00 00 x=1 y=1 pixel value? is supposed to be black
00 00 00 00 x=2 y=1 pixel value? is supposed to be black
最后一个像素值真的很令人困惑,我看不出它们如何等于它们应该等于的值加上我认为 rgb 或 bgr 数据只是 3 个字节?此外,可以找到像素数据的位置的偏移量比位图中的最后一个字节多了 2 个字节……我觉得我在解码它完全错误之类的。