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

react-native-smart-ocr

v0.1.0

Published

react-native-smart-ocr is a high-performance React Native OCR library for Android and iOS focused on image enhancement, accurate text recognition, and number plate detection.

Readme

react-native-smart-ocr

react-native-smart-ocr is an on-device OCR library for React Native (Android) with optional OpenCV-based preprocessing (resize, contrast/CLAHE, adaptive threshold, sharpen, deskew).

Note: iOS is currently a stub (returns "iOS OCR not implemented yet"). Android is fully supported.

Installation

npm install react-native-smart-ocr

Platform setup

Android

No extra steps required. This package includes:

  • Google ML Kit Text Recognition
  • OpenCV (used when enhance: true)

iOS

The native iOS implementation is not available yet.

If you still install on iOS, make sure Pods are installed:

cd ios && pod install

Usage

import { SmartOCR } from 'react-native-smart-ocr';

// Simple (default preprocessing enabled)
const result = await SmartOCR.scanImage('file:///path/to/image.jpg');

// Advanced (tune preprocessing)
const tuned = await SmartOCR.scanImage({
  path: 'file:///path/to/image.jpg',
  enhance: true,
  preprocess: {
    contrast: { enabled: true, clipLimit: 2.5, tileGridSize: 8 },
    adaptiveThreshold: { enabled: true, method: 'gaussian', blockSize: 31, c: 7 },
    sharpen: { enabled: true, amount: 1.0 },
    denoise: { enabled: false },
    deskew: { enabled: true, maxAngle: 10 },
  },
});

console.log(result.text, tuned.confidence);

Example output

{
  "text": "MH01DX7247",
  "confidence": 0.91
}

API

SmartOCR.scanImage(pathOrOptions)

Accepts either:

  • string image path/URI (recommended: file:// URI from image picker), or
  • SmartOCRScanOptions object.

Returns Promise<SmartOCRScanResult>:

  • text: full recognized text
  • confidence: heuristic score in [0..1]
  • processingTime: ms
  • blocks: text blocks with boundingBox, cornerPoints, nested lines and elements

SmartOCR.scanImageWithOptions(options)

Alias for scanImage(options).

Preprocessing options

When enhance: true, preprocessing runs on Android (best-effort; if OpenCV init fails it falls back to the original image).

  • resize: downscale long side (helps performance / stability on very large images)
  • grayscale: convert to grayscale before OCR
  • denoise: Gaussian/median blur (can help noisy images, but may hurt plates)
  • contrast: CLAHE (helps low-contrast / night images)
  • adaptiveThreshold: binarization (can help invoices / scanned docs)
  • sharpen: kernel sharpen (can help slight blur)
  • deskew: best-effort rotation correction

Errors

Android rejects promises with standardized error codes:

  • SMART_OCR_INVALID_PATH
  • SMART_OCR_IMAGE_LOAD_FAILED
  • SMART_OCR_OCR_FAILED

React Native compatibility

  • React Native: >= 0.74

Screenshots

Add screenshots/GIFs here (recommended):

  • Original image + overlayed block bounding boxes
  • Example JSON output

Roadmap

  • iOS OCR implementation
  • Optional number-plate oriented post-processing helpers
  • Optional debug overlay helpers (render ML Kit block/line/element boxes)

Contributing

License

MIT