@mbtech-nl/bitmap / padBitmap
Function: padBitmap()
ts
function padBitmap(bitmap: LabelBitmap, padding: {
bottom?: number;
left?: number;
right?: number;
top?: number;
}): LabelBitmap;Defined in: transform.ts:311
Add white margins around an existing bitmap.
Each side defaults to 0; only specify the sides you need.
Parameters
| Parameter | Type | Description |
|---|---|---|
bitmap | LabelBitmap | Source bitmap. |
padding | { bottom?: number; left?: number; right?: number; top?: number; } | Margins in pixels per side. |
padding.bottom? | number | - |
padding.left? | number | - |
padding.right? | number | - |
padding.top? | number | - |
Returns
A new bitmap with the original content offset by padding.left/padding.top.
Example
ts
const padded = padBitmap(content, { top: 4, bottom: 4, left: 8, right: 8 });