CrImage::BMP::Reader
Inherits CrImage::BMP::Reader::Consts / Reference / Object
BMP Reader decodes Windows Bitmap files.
Supports:
- BITMAPFILEHEADER + BITMAPINFOHEADER structure
- 8-bit paletted (256 colors with BGR palette)
- 24-bit RGB (BGR byte order)
- 32-bit RGBA (BGRA byte order)
- Top-down (negative height) and bottom-up orientation
- Uncompressed images only (compression = 0)
- 4-byte row alignment padding
Does not support:
- Compressed formats (RLE, BITFIELDS with custom masks)
- Multiple color planes
- Bit depths other than 8, 24, 32
Class methods
Reads and decodes a BMP image from a file.
Parameters:
path: Path to the BMP file
Returns: Decoded image (Paletted for 8-bit, RGBA for 24-bit, NRGBA for 32-bit)
Reads and decodes a BMP image from an IO stream.
Parameters:
io: IO stream containing BMP data
Returns: Decoded image
Reads BMP metadata without decoding pixel data.
Parses the file header and info header to extract dimensions, bit depth, and color palette (for 8-bit images).
Parameters:
path: Path to the BMP file
Returns: Config with image metadata
Raises: FormatError if format is invalid or unsupported
Reads BMP metadata from an IO stream without decoding pixel data.
Parameters:
io: IO stream containing BMP data
Returns: Config with image metadata
Instance methods
depth
Sourceheight
Sourceimage
Sourceio
Sourcetopdown
Sourcewidth
Source