led-gen converts regular images into an LED-style rendering. The image
processing core is written in Rust and is shared by the command-line tool and
the WebAssembly/TypeScript package.
| Path | Package | Purpose |
|---|---|---|
crates/led-gen-core |
led-gen-core |
Shared Rust image-processing implementation. |
crates/led-gen-cli |
led-gen-cli |
Command-line image converter. |
crates/led-gen-wasm |
led-gen-wasm |
wasm-bindgen bindings for the Rust core. |
packages/led-gen |
led-gen |
TypeScript wrapper around the generated WASM package. |
Run the CLI from the workspace:
cargo run -p led-gen-cli -- test/input-0001.png --output test/output.pngUseful options:
cargo run -p led-gen-cli -- input.png \
--output output.png \
--format png \
--led-size 4 \
--led-gap 2 \
--led-shape circle \
--no-glowThe CLI reads led-gen.config.toml from the current directory when it exists.
Use --config <path> to load a specific config file. CLI options override
values from the config file.
See crates/led-gen-cli/readme.md for the full CLI documentation.
Install the npm package:
npm install led-genUse it with browser ImageData:
import { LedGenerator } from "led-gen";
const source = ctx.getImageData(0, 0, image.width, image.height);
const result = await LedGenerator.processImageData(source, {
ledShape: "circle",
ledSize: 4,
ledGap: 2,
enableGlow: true,
});
ctx.putImageData(result, 0, 0);See packages/led-gen/readme.md for TypeScript API details.
Check the Rust workspace:
cargo checkBuild the WebAssembly package before building the TypeScript wrapper:
wasm-pack build crates/led-gen-wasm --target web
cd packages/led-gen
pnpm install
pnpm run buildBSD 2-Clause License. See LICENSE for details.

