npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@nijatk/react-native-opencv-wrapper

v1.7.0

Published

React Native wrapper for OpenCV with optional bundled binaries

Readme

@nijatk/react-native-opencv-wrapper

React Native (New Architecture) wrapper for OpenCV with optional bundled binaries — 60+ image-processing and analysis operations, available as one-shot functions or a fused single-pass pipeline.

Quality Gate Status

📖 Full documentation & API reference →

The docs site covers every operation, its parameters, pipelines, base64 I/O, structured analysis results, and error codes. This README keeps only the essentials to get installed and running.

Install

npm install @nijatk/react-native-opencv-wrapper
# or
yarn add @nijatk/react-native-opencv-wrapper

iOS — install the native pods:

cd ios && pod install

Rebuild your app after installing so the native module is linked.

Requirements

This package is a TurboModule and requires React Native's New Architecture (enabled by default on RN 0.76+). There is no legacy bridge fallback — if the New Architecture is disabled, the native module will not register.

  • React Native 0.76+ (built/tested on 0.85) · React 19+
  • iOS deployment target 13+ · Android minSdk 24+

Quick start

import { gray, pipeline } from "@nijatk/react-native-opencv-wrapper";

// One-shot: read → transform → write
await gray("/abs/in.png", "/abs/out.png");

// Pipeline: chain ops, run in a single native pass
await pipeline()
  .input("/abs/in.png")
  .output("/abs/out.png")
  .resize(640, 480, "area")
  .gray()
  .gaussianBlur(5)
  .canny(50, 150)
  .run();

All I/O uses absolute filesystem paths (no file:// URIs) or base64; every async call resolves with the output, or rejects with a stable error code. See the documentation for the full API.

Recipes & presets

A pipeline's steps are serializable data. Turn any pipeline into a portable, source-agnostic recipe, then store it, send it over the network, or rebuild it later:

import {
  pipeline,
  Pipeline,
  presets,
} from "@nijatk/react-native-opencv-wrapper";

// Apply a built-in preset (edges, crispScan, softenPortrait)
await pipeline()
  .input("/abs/in.jpg")
  .output("/abs/out.png")
  .apply(presets.edges)
  .run();

// Define your own reusable recipe (no input/output — works on any image)
const punch = pipeline()
  .clahe(2, 8)
  .convertScaleAbs(1.1, 10)
  .gaussianBlur(3)
  .toJSON();

// Persist and reload it
const json = JSON.stringify(punch);
await Pipeline.fromJSON(json).input("/abs/in.jpg").output("/abs/out.jpg").run();

toJSON() (also used by JSON.stringify) snapshots the ops; apply() splices a recipe into any chain; Pipeline.fromJSON() rebuilds a runnable pipeline. See the Recipes & presets docs for details.

Batch processing

Apply one recipe across many images in a single call with runBatch. Results come back in input order and mirror Promise.allSettled, so one bad file never fails the whole run:

import { runBatch, presets } from "@nijatk/react-native-opencv-wrapper";

const results = await runBatch(
  presets.edges,
  [
    { input: "/abs/a.jpg", output: "/abs/a.png" },
    { input: "/abs/b.jpg", output: "/abs/b.png" },
  ],
  { concurrency: 4 }, // optional: cap images in flight (defaults to all)
);

const failed = results.filter((r) => r.status === "rejected");

Inputs and outputs accept absolute paths or { base64 } descriptors, so a batch can run entirely in memory. Pass onProgress to drive a progress bar. See the Batch processing docs for details.

OpenCV integration

OpenCV ships bundled by default (Android 4.11.0 via Maven Central; iOS via the OpenCV CocoaPod). Switch to host mode to use an OpenCV your app already provides — in host mode the wrapper declares no OpenCV dependency of its own.

# android/gradle.properties
rnOpenCVMode=host          # use host-provided OpenCV
rnOpenCVVersion=4.11.0     # override the bundled Android version
// package.json (iOS host mode)
{
  "reactNativeOpenCV": {
    "mode": "host",
    "pod": "OpenCV",
    "version": "~> 4.3.0",
  },
}

You can also set RN_OPENCV_MODE=host in the environment. On iOS, if your Podfile already includes a pod whose name begins with OpenCV, host mode is selected automatically.

Example

A working example app lives in example/.

Contributing

Adding an operation is intentionally lightweight — see CONTRIBUTING.md.

License

MIT — see LICENSE.