ImageGear Professional v18.2 > User Guide > Appendices/General Reference > Understanding Bitmap Images > Device Independent and Device Dependent Bitmaps > Device Independent Bitmaps - DIBs |
A DIB consists of a header structure called a BITMAPINFOHEADER followed by the color palette, if one is present, followed by the bitmap (pixel) data:
BITMAPINFOHEADER |
COLOR PALETTE (if any) |
BITMAP DATA |
The BITMAPINFOHEADER structure contains such information as the number of bits per pixel, number of pixels per row, and total number of rows in the image, as well as whether the bitmap data has been compressed for more efficient storage. Its form is shown below.
BITMAPINFOHEADER: | DWORD | biSize |
LONG | biWidth | |
LONG | biHeight | |
WORD | biPlanes | |
WORD | biBitCount | |
DWORD |
biCompression |
|
DWORD |
biSizeImage |
|
LONG |
biXPelsPerMeter |
|
LONG |
biYPelsPerMeter |
|
DWORD |
biClrUsed |
|
DWORD |
biClrImportant |
A color palette is present in the DIB if the image is 1-bit, 4-bit, or 8-bit. The format of the color palette was described at the beginning of this chapter.
The format of the bitmap data is:
It should be noted that in a DIB, the first row of the bitmap data is the row to be displayed at the bottom of the image. For historical reasons, many file formats store their bitmap data top row first (this is because most devices to which bitmap data is sent display the rows top-to-bottom. Such devices, which include most CRT display monitors, are often called raster-scan devices.).
Whenever ImageGear loads a file of a format having top-to-bottom row ordering, it automatically reverses the order of the rows, assuring bottom-to-top row ordering for all DIBs, regardless of where the image originated. Keep in mind the ordering of a DIB is therefore "upside down" relative to the convention used in much display software that the top row of a display is row 0 and row numbers increase downward.
See also ImageGear Architecture Diagram.