Skip to content

In depth knowledge of Meta-Structures and variables #41

Locked Answered by H1manshu21
sabyasachi07 asked this question in Q&A
Discussion options

You must be logged in to vote

Actual calculation for bfOffBits of BITMAPFILEHEADER,

bfOffBits = sizeof (BITMAPFILEHEADER) + NumberOfRGBTRIPLE * sizeof (RGBTRIPLE)  + sizeof (BITMAPINFOHEADER);

So looking into our 24bit image, it looks like this:

bfOffBits = 14 + 0 * 4  + 40;
// Prints 54
std::cout << bfOffBits;
  • RGBTRIPLE variable is a color table. It is commonly either 16 colors or 256 colors, depending on how the file is specified in BITMAPINFOHEADER’s biBitCount.

  • In our case, it does not exist in the file because we are using a 24-bit bitmap which is 2^24 = 16777216 colors and doesn't fit in RGBTRIPLE and the bmiColors member of BITMAPINFO is NULL.

  • Each 3-byte triplet in the bitmap array represents the relativ…

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
13 replies
@chandrakant100
Comment options

@H1manshu21
Comment options

@chandrakant100
Comment options

@H1manshu21
Comment options

@sabyasachi07
Comment options

Answer selected by H1manshu21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
documentation Improvements or additions to documentation Important
3 participants