class

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

read(path : String) : CrImage::Image

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)

Source
read(io : IO) : CrImage::Image

Reads and decodes a BMP image from an IO stream.

Parameters:

  • io : IO stream containing BMP data

Returns: Decoded image

Source
read_config(path : String) : CrImage::Config

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

Source
read_config(io : IO) : CrImage::Config

Reads BMP metadata from an IO stream without decoding pixel data.

Parameters:

  • io : IO stream containing BMP data

Returns: Config with image metadata

Source

Instance methods

depth
Source
height
Source
image
Source
topdown
Source
width
Source