BMP_IO
Microsoft BMP bitmap files
Read and Write Utilities
BMP_IO
is a C++ library which
reads or writes the graphics information in
a Microsoft BMP file.
A user program can employ these routines to read a BMP file
and extract and return the graphics information (RGB pixel arrays),
or to write internal RGB pixel arrays into a properly formatted BMP file.
The BMP file format is used for many of the icons seen
cluttering up the desktop of a Windows machine, for instance.
Of course, another interesting application is to read in a BMP file,
and write out the RGB information to a file in another format.
Since some of the data is multibyte, the format of the file can
depend on whether such data is written with the bytes in
"little-endian" or "big-endian" order. The program maintains a
variable called BMP_BYTE_SWAP which controls how the program
assumes the bytes are ordered. Setting this variable to
true show be the appropriate value for little-endian ordering,
while false is for big-endian. This variable can be read
by calling the function bmp_byte_swap_get, or set by calling
bmp_byte_swap_set.
Licensing:
The computer code and data files described and made available on this web page
are distributed under
the GNU LGPL license.
Languages:
BMP_IO is available in
a C++ version.
Related Data and Programs:
BMP,
a data directory which
contains example BMP files.
BMP_TO_PPMA,
a C++ program which
converts BMP files to ASCII PPM format.
BMP_TO_PPMB,
a C++ program which
converts BMP files to binary PPM format.
PPMA_TO_BMP,
a C++ program which
converts ASCII PPM files to BMP format.
PPMB_TO_BMP,
a C++ program which
converts binary PPM files to BMP format.
Reference:
-
David Kay and John Levine,
Graphics File Formats,
Second Edition,
McGraw Hill, 1995.
-
John Miano,
Compressed Image File Formats,
Addison Wesley, 1999.
-
Microsoft Corporation,
Microsoft Windows Programmer's Reference,
Volume 5; Messages, Structures, and Macros,
Microsoft Press, 1993.
Source Code:
Examples and Tests:
-
bmp_io_test.cpp, a calling program;
-
bmp_io_test.txt,
output from a run of the calling program;
-
bmp_08.bmp,
a monochrome (8 bits per pixel) BMP file created by the
calling program;
-
bmp_24.bmp,
a three color (24 bits per pixel) BMP file created by the
calling program;
List of Routines:
-
BMP_BYTE_SWAP_GET returns the internal value of BMP_BYTE_SWAP.
-
BMP_BYTE_SWAP_SET sets the internal value of BMP_BYTE_SWAP.
-
BMP_08_DATA_READ reads 8 bit image data of the BMP file.
-
BMP_08_DATA_WRITE writes 8 bit image data to a BMP file.
-
BMP_24_DATA_READ reads 24 bit image data of the BMP file.
-
BMP_24_DATA_WRITE writes 24 bit image data to the BMP file.
-
BMP_HEADER1_PRINT prints the header information of a BMP file.
-
BMP_HEADER1_READ reads the header information of a BMP file.
-
BMP_HEADER1_WRITE writes the header information to a BMP file.
-
BMP_HEADER2_PRINT prints the bitmap header information of a BMP file.
-
BMP_HEADER2_READ reads the bitmap header information of a BMP file.
-
BMP_HEADER2_WRITE writes the bitmap header information to a BMP file.
-
BMP_PALETTE_PRINT prints the palette data in a BMP file.
-
BMP_PALETTE_READ reads the palette information of a BMP file.
-
BMP_PALETTE_WRITE writes the palette data to the BMP file.
-
BMP_PRINT_TEST tests the BMP print routines.
-
BMP_READ reads the header and data of a BMP file.
-
BMP_READ_TEST tests the BMP read routines.
-
BMP_08_WRITE writes the header and data for a monochrome BMP file.
-
BMP_08_WRITE_TEST tests the BMP write routines.
-
BMP_24_WRITE writes the header and data for a BMP file using three colors.
-
BMP_24_WRITE_TEST tests the BMP write routines.
-
LONG_INT_READ reads a long int from a file.
-
LONG_INT_WRITE writes a long int to a file.
-
U_LONG_INT_READ reads an unsigned long int from a file.
-
U_LONG_INT_WRITE writes an unsigned long int to a file.
-
U_SHORT_INT_READ reads an unsigned short int from a file.
-
U_SHORT_INT_WRITE writes an unsigned short int to a file.
You can go up one level to
the C++ source codes.
Last revised on 09 December 2005.