bmp_file_reader.BMPFileReader

class bmp_file_reader.BMPFileReader(file_handle)

Bases: object

An object for reading a BMP image file.

__init__(file_handle)

Creates a BMPFileReader from the given file handle.

The file handle must have been opened in read binary mode (“rb”).

Parameters:

file_handle (io.TextIOWrapper) – The file handle of the BMP image to read.

Methods

__init__(file_handle)

Creates a BMPFileReader from the given file handle.

get_height()

Returns the height of the image (in pixels).

get_row(row)

Reads in the pixels of the specified row (zero-indexed).

get_width()

Returns the width of the image (in pixels).

read_bmp_file_header()

Returns the BMP file header of the image.

read_dib_header()

Returns the DIB header of the BMP file.

get_height()

Returns the height of the image (in pixels).

Returns:

Height of the image in pixels.

Return type:

int

get_row(row)

Reads in the pixels of the specified row (zero-indexed).

Parameters:

row (int) – The index of the row to read.

Returns:

The colors of the pixels in the specified row.

Return type:

List[Color]

get_width()

Returns the width of the image (in pixels).

Returns:

Width of the image in pixels.

Return type:

int

read_bmp_file_header()

Returns the BMP file header of the image.

Returns:

BMP file header of the image.

Return type:

BMPHeader

read_dib_header()

Returns the DIB header of the BMP file.

Returns:

DIB header of the image.

Return type:

DIBHeader