image - 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
what values of width , height?
according wikipedia - bmp file format
offset (hex) offset (dec) size (bytes) windows bitmapinfoheader[1] 0e 14 4 size of header (40 bytes) 12 18 4 bitmap width in pixels (signed integer) 16 22 4 bitmap height in pixels (signed integer)
with bitmap header posted, width , height be
width: d1 02 00 00 height: 1d 02 00 00
the wikipedia link above states that
all of integer values stored in little-endian format (i.e. least-significant byte first).
if understanding correct, converts to
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
Comments
Post a Comment