Skip to content

@mbtech-nl/bitmap / bytesPerRow

Function: bytesPerRow() ​

ts
function bytesPerRow(widthPx: number): number;

Defined in: encode.ts:64

Number of packed bytes used to store one row of widthPx pixels.

Equivalent to Math.ceil(widthPx / 8) — exposed as a named function so call sites read clearly and so future encoders can rely on a single authoritative implementation.

Parameters ​

ParameterType
widthPxnumber

Returns ​

number

Example ​

ts
bytesPerRow(384); // 48
bytesPerRow(385); // 49

Released under the MIT License.