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

@uziee/document-scanner

v1.2.0

Published

A lightweight, zero-dependency React document scanner with real-time edge detection, stability filtering, and perspective correction (bilinear warping) for high-resolution A4 captures.

Downloads

1,027

Readme

@uziee/document-scanner

npm version

A high-performance, lightweight React component for real-time document detection, stability filtering, and perspective-corrected scanning.

🔗 Live Demo

Try it now: https://document-scanner.vercel.app

🚀 Key Features

  • Real-Time Edge Detection: Custom pixel-analysis algorithm to identify documents without the overhead of OpenCV.
  • Anti-Jitter Stability: Built-in "Stability Counter" that prevents false triggers from noisy backgrounds or rugs.
  • Bilinear Warp Transformation: Automatically "flattens" skewed documents into a clean, rectangular A4-proportioned image.
  • Zero Dependencies: Runs entirely on native Canvas API—no massive WASM files or external ML models.
  • High-Res Capture: Analyzes a low-res stream for performance but captures the final document from the full-resolution camera feed.
  • Close Button: Users can exit the scanner anytime without capturing.

📦 Installation

npm install @uziee/document-scanner

📖 Usage

Import the DocumentScanner component into your React application and provide the callback props to handle scanning events.

Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | onCapture | (images: string[]) => void | Yes | Callback fired when user finishes scanning. Receives an array of base64 image data URLs. | | onClose | () => void | No | Callback fired when user taps the close button (X) to exit the scanner without capturing. |

Example

import React, { useState } from 'react';
import DocumentScanner from '@uziee/document-scanner';

function App() {
  const [showScanner, setShowScanner] = useState(false);
  const [scannedImages, setScannedImages] = useState([]);

  const handleCapture = (images) => {
    console.log(`Captured ${images.length} document(s)`);
    setScannedImages(images);
    setShowScanner(false);
  };

  const handleClose = () => {
    // User closed the scanner without capturing
    setShowScanner(false);
  };

  return (
    <div>
      <button onClick={() => setShowScanner(true)}>Scan Document</button>
      
      {showScanner && (
        <DocumentScanner 
          onCapture={handleCapture} 
          onClose={handleClose} 
        />
      )}

      {scannedImages.map((img, i) => (
        <img key={i} src={img} alt={`Scanned ${i + 1}`} />
      ))}
    </div>
  );
}

export default App;

The component renders a full-screen camera interface for document scanning. It detects documents in real-time, applies stability filtering, and captures high-resolution images with perspective correction.

UI Controls

  • Close Button (X): Located in the top-right corner. Calls onClose to exit without capturing.
  • Status Indicator: Shows "POSITION DOCUMENT" or "READY TO SCAN" based on detection state.
  • Shutter Button: Captures the current document when detection is stable.
  • Thumbnail/Done: Shows captured images count; tap to finish and return all images via onCapture.

Ensure your application has camera permissions enabled for the component to function properly.