voxolith

contactSheet()

Tile renders into one captioned image, left to right then top to bottom, each cell as large as the largest render. Comparing variants side by side is the main output of a preview run.

function contactSheet(cells: SheetCell[], opts?: SheetOptions): RenderResult;

Defined in: preview/sheet.ts:48

Parameters

ParameterTypeDescription
cellsSheetCell[]At least one; throws on an empty list.
opts?SheetOptionsColumns, spacing, colours and an optional title.

Returns

RenderResult

The sheet as one image.

Example

const cells = [1, 2, 3].map((seed) => ({
  render: renderEntity(generateRock(PRESETS.boulder, seededRandom(seed)).entity, { width: 240 }),
  label: `seed ${seed}`,
}));
const sheet = contactSheet(cells, { cols: 3, title: "boulder" });
await Bun.write("rocks.png", encodePng(sheet.width, sheet.height, sheet.rgb));

On this page