Skip to content

cameraui/rust-decoder

Repository files navigation

@camera.ui/rust-decoder

Native Rust pixel-format conversion, resize and crop for the camera.ui ecosystem.

Built with napi-rs — ships prebuilt binaries for Linux (glibc/musl), macOS, Windows and FreeBSD across x64, arm64 and riscv64, so there is no compile step on install.

Installation

npm install @camera.ui/rust-decoder

Usage

import {
  convertNv12ToRgb,
  processImage,
  resizeImage,
  cropImage,
} from '@camera.ui/rust-decoder';

// NV12 frame -> packed RGB
const rgb = convertNv12ToRgb(frame, width, height);

// One-shot convert + crop + resize pipeline
const out = processImage(
  inputFrame, inputWidth, inputHeight,
  inputFormat, outputFormat,
  cropTop, cropLeft, cropWidth, cropHeight,
  resizeWidth, resizeHeight,
);

Also exposes individual convert* helpers (NV12/YUV → RGB/RGBA/grayscale, BGRA/RGBA/RGB conversions), plus resizeImage, cropImage and resizeAndCrop. See index.d.ts for the full signatures.

Development

npm install
npm run build        # release build (napi build --platform --release)
npm run build:debug  # debug build
npm run lint         # cargo clippy + eslint

Part of the camera.ui ecosystem - A comprehensive camera management solution.

About

Native Rust pixel-format conversion, resize & crop for the camera.ui ecosystem.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Contributors