Skip to content

Instantly share code, notes, and snippets.

@hakanai
Last active September 14, 2018 02:23
Show Gist options
  • Save hakanai/9983d49ba9d0a2ae1b1bdc33ab3cc9d2 to your computer and use it in GitHub Desktop.
Save hakanai/9983d49ba9d0a2ae1b1bdc33ab3cc9d2 to your computer and use it in GitHub Desktop.
Some BMP format stuff
BMP file
{
42 4d - magic 'BM'
8e 00 00 00 - total file size
00 00 00 00 - application specific reserved stuff
8a 00 00 00 - offset to pixel array
DIB header (BITMAPV5HEADER)
{
7c 00 00 00 - DWORD biSize = 0x7c (bytes in header from here)
01 00 00 00 - LONG biWidth = 1 pixel
01 00 00 00 - LONG biHeight = 1 pixel
01 00 - WORD biPlanes = 1 plane
20 00 - WORD biBitCount = 32 bpp
03 00 00 00 - DWORD biCompression = 3 (BI_BITFIELDS)
04 00 00 00 - DWORD biSizeImage = 4 (size of raw bitmap data)
00 00 00 00 - LONG biXPelsPerMeter = 0 pixels/m
00 00 00 00 - LONG biYPelsPerMeter = 0 pixels/m
00 00 00 00 - DWORD biClrUsed = 0 colours used
00 00 00 00 - DWORD biClrImportant = 0 (all colours are important)
00 00 ff 00 - red channel mask
00 ff 00 00 - green channel mask
ff 00 00 00 - blue channel mask
00 00 00 ff - alpha channel mask
42 47 52 73 - colour space 'BGRs'
Colour space data (CIEXYZTRIPLE)
{
Red (CIEXYZ)
{
80 c2 f5 28 - X
60 b8 1e 15 - Y
20 85 eb 01 - Z
}
Green (CIEXYZ)
{
40 33 33 13 - X
80 66 66 26 - Y
40 66 66 06 - Z
}
Blue (CIEXYZ)
{
a0 99 99 09 - X
3c 0a d7 03 - Y
24 5c 8f 32 - Z
}
}
00 00 00 00 - red gamma
00 00 00 00 - green gamma
00 00 00 00 - blue gamma (BITMAPV4HEADER would end here)
04 00 00 00 - intent, 4 = LCS_GM_IMAGES, bitmap contains an image and contrast should be maintained
00 00 00 00 - profile data
00 00 00 00 - profile size
00 00 00 00 - reserved
}
Pixel array
{
f7 f3 9a 5b (red 9a, green f3, blue f7, alpha 5b)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment