Skip to content

@mbtech-nl/bitmap / rotateBitmap

Function: rotateBitmap() ​

ts
function rotateBitmap(bitmap: LabelBitmap, degrees: 90 | 180 | 270): LabelBitmap;

Defined in: transform.ts:50

Rotate a bitmap clockwise by 90, 180, or 270 degrees.

For 90 and 270 the output dimensions are swapped (widthPx and heightPx exchange). For 180 the dimensions are unchanged.

Parameters ​

ParameterTypeDescription
bitmapLabelBitmapSource bitmap.
degrees90 | 180 | 270Rotation amount; 90, 180, or 270.

Returns ​

LabelBitmap

A new bitmap; the input is not mutated.

Example ​

ts
const portrait = rotateBitmap(landscape, 90);

Released under the MIT License.