@paragraf/color-wasm
v0.7.0
Published
Rust/WASM ICC color transform backend for @paragraf/color.
Maintainers
Readme
@paragraf/color-wasm
Rust/WASM acceleration for the ICC colour transforms of
@paragraf/color. Part of the
paragraf typesetting library.
The compiled WASM module is included in the npm package; no Rust toolchain is needed to use it.
Install
npm install @paragraf/color-wasm @paragraf/colorUsage
import { loadColorWasm, createWasmTransform } from '@paragraf/color-wasm';
const wasm = loadColorWasm(); // throws if the WASM module cannot be loaded
// source and dest are ColorProfile objects from @paragraf/color
const transform = createWasmTransform(wasm, source, dest, 'perceptual');
const out = transform.apply([1, 0, 0]);WasmColorTransform implements the same ColorTransform interface as
createTransform from @paragraf/color.
Accelerated paths:
- RGB matrix → RGB matrix (matrix + tone curves)
- RGB matrix → CMYK/LUT (matrix + tone curves, XYZ → Lab, CLUT)
Other profile combinations (for example a CMYK source) are handled by the
TypeScript implementation in @paragraf/color automatically.
Building the WASM module (contributors)
npm run build:wasm --workspace=2c-color-wasm # needs Rust and wasm-packLicense
MIT
