如何从这个文件头计算位图的宽度和高度?
How do I calculate the width and height of a bitmap from this file header?
00000000 42 4D 3A FE 05 00 00 00-00 00 36 04 00 00 28 00
00000010 00 00 D1 02 00 00 1D 02-00 00 01 00 08 00 00 00
00000020 00 00 04 FA 05 00 13 0B-00 00 13 0B 00 00 00 00
宽度和高度的值是多少?
Offset (hex) Offset (dec) Size (bytes) Windows BITMAPINFOHEADER[1]
0E 14 4 the size of this header (40 bytes)
12 18 4 the bitmap width in pixels (signed integer)
16 22 4 the bitmap height in pixels (signed integer)
使用您发布的位图header,宽度和高度为
Width: D1 02 00 00
Height: 1D 02 00 00
上面的维基百科link指出
All of the integer values are stored in little-endian format (i.e.
least-significant byte first).
如果我的理解是正确的,那就转换成
Width = 209 + (2 x 256) + (0 x 256^2) + (0 x 256^3) = 721
Height = 29 + (2 x 256) + (0 x 256^2) + (0 x 256^3) = 541
00000000 42 4D 3A FE 05 00 00 00-00 00 36 04 00 00 28 00
00000010 00 00 D1 02 00 00 1D 02-00 00 01 00 08 00 00 00
00000020 00 00 04 FA 05 00 13 0B-00 00 13 0B 00 00 00 00
宽度和高度的值是多少?
Offset (hex) Offset (dec) Size (bytes) Windows BITMAPINFOHEADER[1]
0E 14 4 the size of this header (40 bytes)
12 18 4 the bitmap width in pixels (signed integer)
16 22 4 the bitmap height in pixels (signed integer)
使用您发布的位图header,宽度和高度为
Width: D1 02 00 00
Height: 1D 02 00 00
上面的维基百科link指出
All of the integer values are stored in little-endian format (i.e. least-significant byte first).
如果我的理解是正确的,那就转换成
Width = 209 + (2 x 256) + (0 x 256^2) + (0 x 256^3) = 721
Height = 29 + (2 x 256) + (0 x 256^2) + (0 x 256^3) = 541