ImageGear for C and C++ on Windows v19.10 - Updated
BMP
User Guide > File Formats and Compressions > File Formats > File Formats Reference > BMP

Full Name Microsoft Windows Bitmap
Format ID IG_FORMAT_BMP = 2
File Extension(s) *.bmp, *dib
Data Type Raster Image
Data Encoding Binary
Color Profile Support No
Multi-Page Support Only for OS/2 BMP
Alpha Channel Support No
ImageGear Platforms Support WIN32, WIN64, Unix, Unix64, MAC, .NET, .NET64, Java

ImageGear Supported Versions:

ImageGear Supported Features:

ImageGear Read Support:

ImageGear Write Support:

ImageGear Filter Control Parameters:

Filter Control Parameter Type Default Value Available Values Description
UPSIDE_DOWN AT_BOOL FALSE FALSE, TRUE If TRUE then the images will be saved upside-down
TYPE UINT BMP_TYPE_BMI BMP_TYPE_BMC, BMP_TYPE_BMI, BMP_TYPE_BMI2 Type of BMP, see BMP_TYPE_... constants
COMPRESSION DWORD BMP_COMP_RGB BMP_COMP_RLE4, BMP_COMP_RLE8, BMP_COMP_RGB BMP compression, see BMP_COMP_... constants
B16_GRAY_SCANNER AT_BOOL FALSE FALSE, TRUE Vidar 12-bit scanner options
B16_GRAY_SCANTYPE UINT 0 Vidar 12-bit scanner options

Comments:

The BMP format for versions 2.x - 4.x contains two headers. All Windows bitmap files begin with the same first header. They proceed with a data structure containing image information (the Bitmap Information Header), and end with the actual image data. If there is a palette (1, 4, 8-bit images), it is located between the bitmap information and the bitmap image data.

The first header identifies the format as BMP, and stores the file size and the address of the image. Two additional fields, Reserved1 and Reserved2, are not used and are set to 0.

The second header, known as the "bitmap information header", varies across the versions of Windows bitmaps. The second header for all bitmaps from version 2.x to 5.x have in common the following basic set of information: size of the secondary header in bytes, height and width of the image in pixels, the number of bit planes, the number of bits per pixel, compression scheme (0 = uncompressed, 1 = 4-bit RLE compression, 2 = 8-bit RLE compression, 3 = bitfields encoding was used), size of image in bytes, horizontal and vertical resolution in pixels per meter, the number of colors in the image, and the minimum number of important colors.

If the image is 16 or 32-bits per pixel in resolution, the compression field equals 3, and following the header are values for RedMask, GreenMask and BlueMask, rather than a palette. If the file is 4.x, there are values for an alpha component, color space type, x and y coordinates of red, green or blue endpoints, and gamma values for red, green, and blue coordinate scale values. The "ColorsImportant" field accommodates hardware that supports fewer colors than are contained by the image palette. The most significant colors are determined by counting their frequency of appearance. A value of zero means that all the colors in the image are significant.

The palette, or color table, varies in size depending on the number of colors in the image. This value is stored in the "ColorsUsed" field of the Bitmap Information Header. In the BMP format v. 3, the palette's structure is in "RGBQUAD" format. See the section entitled "Palettes" in for more information. 24-bit images do not use a palette, but rather store the color information directly in the image data.

References Used

Brown, C. Wayne, and Barry J. Shepherd. Graphics File Formats: Reference and Guide. Greenwich, CT.: Manning Publications, 1992.

Murray, James D. and William vanRyper. Encyclopedia of Graphics File Formats. Sebastopol, CA: O'Reilly & Associates, Inc., 1996.