Image module

decode_pnm

procedure · 1 overloadsince 0.28.0Source

Decodes P2/P5 to GRAY8 and P3/P6 to RGB8. Samples are scaled from maxval (1 to 65535) to 8 bits with rounding; binary samples are 16-bit big-endian when maxval exceeds 255.

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

Decodes P2/P5 to GRAY8 and P3/P6 to RGB8. Samples are scaled from maxval (1 to 65535) to 8 bits with rounding; binary samples are 16-bit big-endian when maxval exceeds 255.

Parameters

data: [] u8
max_pixels: s64

Returns

image: Image
ok: bool
error: string

See also