Prerequisites
Before you begin, make sure you have the following installed:- Node.js and npm
- Rust (stable toolchain)
wasm32-unknown-unknowntarget:rustup target add wasm32-unknown-unknownwasm-bindgen-cli:cargo install wasm-bindgen-cli- (Optional)
wasm-optfrom binaryen for smaller builds
Getting Started
Project Structure
Understanding the codebase layout will help you navigate and contribute effectively:js/, the npm package metadata lives at the repo root, and ./scripts/build.sh emits the consumable package into dist/.
Running Tests
kimg has a comprehensive test suite covering Rust core functionality, JavaScript bindings, demo pages, and packaging.Rust Tests
Run all core Rust tests (148 tests covering blend modes, compositing, filters, transforms, codecs, serialization, sprites, color utilities, shape layers, bucket fill, and shared per-layer transforms):JavaScript Tests
Run the Vitest suite that exercises the built JS/WASM facade, subpath exports, and Node-side initialization:Demo Tests
Test the browser demo page with a headless browser to catch runtime failures:/demo/ locally, loads the full visual suite, and fails if the page reports runtime failures, diagnostics, or an incomplete card set.
Package Tests
Smoke-test the published package shape by packing the repo and installing the tarball into temporary Node/browser projects:Run All Tests
Convenience command for the full Rust + package-layer test pass:Development Workflow
Make your changes
Implement your feature or bug fix. Add tests for any new functionality you create.
- Tests for Rust code go in
#[cfg(test)] mod testsblocks within each source file - Prefer concrete assertions over fuzzy ranges in tests when possible
Run the test suite
Before committing, run the comprehensive test suite:If you changed the browser demo or visual test suite:If you changed packaging, exports, or the build pipeline:
Format your code
Run the formatters to ensure consistent code style:For Rust code:For JavaScript/TypeScript code:Check formatting without making changes:
Code Style Guidelines
- Rust: Run
cargo fmtbefore committing - JavaScript/TypeScript: Run
npm run fmt:jsbefore committing (usesoxfmtfor formatting) - Dependencies: Keep dependencies minimal - WASM binary size matters
- Tests: Place tests in
#[cfg(test)] mod testsblocks within each source file - Assertions: Prefer concrete assertions over fuzzy ranges when possible
Running the Demo
The demo page atdemo/index.html loads from dist/. Serve it with any static file server:
What to Work On
Check the open issues for current priorities. Areas where help is most useful:- Documentation improvements
- Benchmarks and performance optimization
- SIMD optimization
- Fuzz testing
- Bug fixes and feature requests