@jimp/layout
Lay out boxes, text and images like CSS flexbox, and draw them with Jimp.
For Open Graph cards, social banners and badges. You describe the image as a tree of boxes, text and images, laid out in rows and columns, and `render` measures and wraps the text, positions everything and draws it. It's plain JavaScript with no browser, SVG or WebAssembly step, so it runs in Node.js, browsers, workers and Bun.
`@jimp/layout` isn't part of `jimp`. Install it alongside:
```sh
npm install jimp @jimp/layout
```
Write the image with JSX (no React needed) by setting `"jsx": "react-jsx"` and `"jsxImportSource": "@jimp/layout"` in your `tsconfig.json`:
```tsx
import { Jimp } from "jimp";
import { loadTTF } from "jimp/load-ttf";
import { Box, Text, render } from "@jimp/layout";
const regular = await loadTTF("Inter-Regular.otf");
const bold = await loadTTF("Inter-Bold.otf");
function Tag({ label }: { label: string }) {
return (