bmp_io


bmp_io, a C++ code 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 information on this web page is distributed under the MIT license.

Languages:

bmp_io is available in a C++ version.

Related Data and Programs:

bmp_io_test

bmp, a data directory which contains example BMP files.

bmp_to_ppma, a C++ code which converts BMP files to ASCII PPM format.

bmp_to_ppmb, a C++ code which converts BMP files to binary PPM format.

ppma_to_bmp, a C++ code which converts ASCII PPM files to BMP format.

ppmb_to_bmp, a C++ code which converts binary PPM files to BMP format.

Reference:

  1. David Kay and John Levine,
    Graphics File Formats,
    Second Edition,
    McGraw Hill, 1995.
  2. John Miano,
    Compressed Image File Formats,
    Addison Wesley, 1999.
  3. Microsoft Corporation,
    Microsoft Windows Programmer's Reference,
    Volume 5; Messages, Structures, and Macros,
    Microsoft Press, 1993.

Source Code:


Last revised on 22 October 2024.