Rust-first, local-only SDK workspace for background removal across CLI, Tauri, and native mobile.
If you are integrating this SDK into an app, use these guides first:
- Tauri consumer quickstart:
docs/TAURI_CONSUMER.md - Android consumer quickstart:
docs/ANDROID_CONSUMER.md - iOS consumer quickstart:
docs/IOS_CONSUMER.md - Common troubleshooting:
docs/TROUBLESHOOTING.md
apps/unbg-cli: CLI entrypoint with model management commands.crates/unbg-core: shared inference policy and core contracts.crates/unbg-model-registry: model directory and lockfile types.crates/unbg-installer: local model install and verification flow.crates/unbg-runtime-ort: ONNX runtime integration surface (stubbed).crates/unbg-image: image sizing helpers (placeholder utilities).crates/unbg-bench: benchmark case definitions.crates/unbg-uniffi: shared FFI-safe boundary for mobile bindings.integrations/tauri-plugin-unbg: Tauri adapter over the shared core/runtime.integrations/android-unbg: Android bridge contract for local inference.integrations/ios-unbg: iOS bridge contract for local inference.apps/smoke-tests: cross-runtime conformance smoke tests.
cargo build
cargo run -p unbg-cli -- models install --model fast
cargo run -p unbg-cli -- models install --all
cargo run -p unbg-cli -- models list
cargo run -p unbg-cli -- models verify
cargo run -p unbg-cli -- exec -i ./input.jpg
cargo run -p unbg-cli -- exec -i ./input.jpg -o ./out/cutout.png
cargo run -p unbg-cli -- exec -i ./input.jpg -m ./out/mask.png -M quality
cargo run -p smoke-tests
cargo testexec defaults to model fast and writes <input>_cutout.<ext> in the same directory when no output flags are provided.
If required models are missing, exec installs them automatically before inference.
Use these commands:
irm https://unbg.io/install.ps1 | iexcurl -fsSL https://unbg.io/install.sh | shInstaller scripts are included at the workspace root as install.ps1 and install.sh.
They auto-detect OS and architecture, then download the matching GitHub Release archive for unbg.
Optional environment overrides:
UNBG_INSTALL_REPO(default:unbgio/core-sdk)UNBG_INSTALL_VERSION(default:latest, or set a tag likev0.1.0)UNBG_INSTALL_DIR(default: per-user bin directory)UNBG_BINARY_NAME(default:unbg/unbg.exe)
Use the helper script to prepare packaged model bundles for consumers:
# Tauri package: rmbg-1.4 + rmbg-2.0 (requires HF token)
HF_TOKEN=... scripts/prepare-model-bundle.sh --profile tauri-full --out ./dist/model-bundles/tauri
# Mobile package: rmbg-1.4 fp16 only
scripts/prepare-model-bundle.sh --profile mobile-lite --out ./dist/model-bundles/mobileBoth profiles run install + verify and write a full model directory that you can ship with your app and pass as modelDir in platform APIs.
Recommended profiles:
tauri-full:rmbg-1.4+rmbg-2.0(requiresHF_TOKEN)mobile-lite:rmbg-1.4fp16 only
rmbg-2.0 is gated and requires HF_TOKEN during install.
Model aliases: fast -> rmbg-1.4, quality -> rmbg-2.0.
- Android AAR:
scripts/build-android.sh - iOS XCFramework:
scripts/build-ios.sh - Tauri plugin mode:
cargo build -p tauri-plugin-unbg --features tauri-plugin
CI workflows are defined under .github/workflows/ for workspace checks plus Tauri/Android/iOS artifacts.
- API compatibility policy:
docs/API_COMPATIBILITY.md - Security/release hygiene:
docs/SECURITY_RELEASE.md - Compatibility snapshot check:
python scripts/check-api-compat.py - Artifact manifest generation:
scripts/release-manifest.sh - Artifact signing helper:
scripts/sign-artifacts.sh
Telemetry sinks can be configured with:
UNBG_TELEMETRY_SINK=stdout|file|httpUNBG_TELEMETRY_FILE=/path/to/telemetry.log(for file sink)UNBG_TELEMETRY_ENDPOINT=https://example.com/events(for http sink)