Image module

decode_bmp

procedure · 1 overloadsince 0.28.0Source

Decodes BMP files of 1, 4, 8 (palette, optionally RLE), 16, 24 and 32 bits per pixel, with channel masks for 16 and 32. Palettised and 24-bit images become RGB8. 16 and 32-bit images become RGBA8 when they have an alpha mask (or, for 32-bit without masks, any nonzero alpha byte) and RGB8 otherwise.

decode_bmp :: (
    data: [] u8,
    max_pixels: s64 = DEFAULT_MAX_PIXELS
) -> (image: Image, ok: bool, error: string)

Decodes BMP files of 1, 4, 8 (palette, optionally RLE), 16, 24 and 32 bits per pixel, with channel masks for 16 and 32. Palettised and 24-bit images become RGB8. 16 and 32-bit images become RGBA8 when they have an alpha mask (or, for 32-bit without masks, any nonzero alpha byte) and RGB8 otherwise.

Parameters

data: [] u8
max_pixels: s64

Returns

image: Image
ok: bool
error: string

See also