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

dynamsoft-capture-vision-for-node

v3.2.5002

Published

Dynamsoft Capture Vision (DCV) is a comprehensive SDK that integrates various functional products. It encompasses image capture, content understanding, result parsing, and interactive workflow. Essentially, DCV processes images to extract specific informa

Downloads

1,401

Readme

Dynamsoft Capture Vision for Node

This is a Node.js wrapper for Dynamsoft Capture Vision, enabling you to read barcodes, recognize partial label text, capture documents, and perform other advanced vision tasks.

Install SDK

npm i [email protected] -E
# In many tasks, we used AI models.
# For simplicity, we will also load this package.
npm i [email protected] -E

Getting Started

Take barcode reading from an image as an example.

const { LicenseManager, CaptureVisionRouter, EnumPresetTemplate } = require('dynamsoft-capture-vision-for-node');

// You can get your reading barcodes trial license from
// https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&package=desktop
// You can get your recognizing partial label text, capturing documents or other feature trial license from
// https://www.dynamsoft.com/customer/license/trialLicense?product=dcv&package=desktop
// The current used license is valid for only one day.
LicenseManager.initLicense('DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9');

(async()=>{
  // you can get the image from https://github.com/Dynamsoft/capture-vision-nodejs-samples/blob/main/AllSupportedBarcodeTypes.png
  // The second parameter `templateName` tells the SDK how to process this image.
  let result = await CaptureVisionRouter.captureAsync('./AllSupportedBarcodeTypes.png', EnumPresetTemplate.PT_READ_BARCODES_READ_RATE_FIRST);
  // refer to https://www.dynamsoft.com/capture-vision/docs/server/programming/cplusplus/api-reference/capture-vision-router/auxiliary-classes/captured-result.html?product=dbr&lang=cplusplus
  // or run `console.log(require('node:util').inspect(result, false, null))` to see details
  for(let item of result.barcodeResultItems){
    console.log(item.text);
  }

  // Terminate workers so you can exit the process.
  // Don't call it if you still need to use the SDK.
  await CaptureVisionRouter.terminateIdleWorkers();
})();

If your trial license expired, please visit private trial for reading barcodes or private trial for recognizing partial label text, capturing documents or other feature.

[!NOTE] Guide for tasks such as Label Recognition and Document Capturing are under development. You can refer to the C++ document while writing code for Node.js. Or contact us for assistance.

Template Customization

The functionality of DCV largely depends on the choice of template. Dynamsoft offers preset templates in EnumPresetTemplate.XXXX. We show the part about barcode:

/** compatible with "read-barcodes" */
PT_READ_BARCODES = "ReadBarcodes_Default",
/** Represents a barcode reading mode where speed is prioritized. */
PT_READ_BARCODES_SPEED_FIRST = "ReadBarcodes_SpeedFirst",
/** Represents a barcode reading mode where barcode read rate is prioritized. */
PT_READ_BARCODES_READ_RATE_FIRST = "ReadBarcodes_ReadRateFirst",
/** Represents a barcode reading mode for single barcode code detection. */
PT_READ_SINGLE_BARCODE = "ReadSingleBarcode",

How to Specific the Barcode Formats

Below is an example illustrating how to modify the target barcode formats for PT_READ_BARCODES_READ_RATE_FIRST.

  1. Copy SDK's Templates\DBR-PresetTemplates.json to your place. This file contains all the preset templates related to barcode reading.

  2. Search BarcodeFormatIds and choose the one you need.

    e.g., If you only want to read specific barcode formats and ensure a high recognition rate in PT_READ_BARCODES_READ_RATE_FIRST, you can modify the BarcodeFormatIds object in the task-read-barcodes-read-rate task.

  3. Suppose you only want to recognize QRCode and DataMatrix, you can change BarcodeFormatIds like this. You can get barcode format strings here.

     "Name": "task-read-barcodes-read-rate",
     "ExpectedBarcodesCount": 0,
     "BarcodeFormatIds": [
    -  "BF_DEFAULT"
    +  "BF_QR_CODE",
    +  "BF_DATAMATRIX"
     ],
  4. Apply this template.

    CaptureVisionRouter.initSettings('path/to/the/template/file');

[!WARNING] Due to its powerful customization capabilities, the number of configurable parameters in the templates is extensive and relatively complex. To ease your workload, if the preset templates do not meet your requirements, feel free to contact us for a customized template.

About the capture like API

captureAsync(...) process images in worker. The maximum number of workers is defined by CaptureVisionRouter.maxWorkerCount, which defaults to <logical processor number> - 1 (minimum of 1). If you continue to call captureAsync(...) while all workers are busy, the tasks will be queued and wait for execution. You can get the queue length by CaptureVisionRouter.waitQueueLength.

The synchronous version is capture(...), which processes images on the main thread.

The capture like APIs can accept file path string or file bytes Uint8Array as input data. Currently supported file types are jpg, png, bmp, gif, pdf, tiff. The capture like APIs also accept DCVImageData as input data. Typically used to process raw data from a camera.

interface DCVImageData{
  bytes: Uint8Array;
  width: number;
  height: number;
  stride: number;
  format: EnumImagePixelFormat;
  /** EXIF orientation; 1 or undefined means no rotate. */
  orientation?: number;
}

If input data is file bytes or DCVImageData, by default, captureAsync(...) will transfer bytes into worker. Thus you can't access to these bytes in main thread after captureAsync. This allows for optimal performance.

The following code can prevent bytes from being transferred.

let result = await CaptureVisionRouter.captureAsync(
  input_data_contains_bytes, {
    templateName: EnumPresetTemplate.XXXX,
    dataTransferType: 'copy'
  }
);

For multi-page PDF and TIFF, you can use captureMultiPages.

let results = await CaptureVisionRouter.captureMultiPagesAsync('./multi-page.pdf', EnumPresetTemplate.XXXX);
for(let result of results){
  const tag = result.originalImageTag;
  console.log(`# page ${tag.pageNumber}/${tag.totalPages}:`);
  for(let item of result.barcodeResultItems){
    console.log(item.text);
  }
}

Supported OS/Arch

Node.js >= 16.x

| os | arch | |:-----|:-------| | win32 (windows) | x86, x64 (Vista or newer) | | linux | x64 (glibc >= 2.18), arm64 | | darwin (mac) | x64, arm64 |

You can force(-f) install resources pkgs (dynamic libraries) for other OS/arch. So you can develop and deploy in different machines. You can check the <OS>-<arch>@<version> in this SDK's package.json->optionalDependencies.

npm i dynamsoft-capture-vision-for-node-lib-<OS>-<arch>@<version> -f -E

Samples

Web Service

Express sample and koa sample shows how to use the SDK in a web service.

You do not need to start multiple instance processes in PM2 Cluster mode. As mentioned above, Dynamsoft Capture Vision for Node already manages a thread pool. However, pm2 start app.js is still useful, it can automatically restart app.js when service crashes.

AWS Lambda

We also made special adaptation for AWS lambda, see this sample. Other similar single-function platforms may have some compatibility issues. If you have any needs, please contact us.

PDF Advanced

If you want more control when processing PDFs, such as controlling the DPI or specifying which pages to process, please refer to this sample.

Special Notes

AI Model

When performing

  • barcode recognition tasks excpet PT_READ_BARCODES_SPEED_FIRST
  • text recognition tasks

you need to install dynamsoft-capture-vision-for-node-model. You can check the <version> in SDK's package.json->peerDependencies.

npm i dynamsoft-capture-vision-for-node-model@<version> -E

Multiple CaptureVisionRouter Instances

In some rare cases you may need multiple CaptureVisionRouter instances, such as customizing different templates for each instance. Here is how to use:

let cvr = new CaptureVisionRouter();

let settings = cvr.outputSettings('<templateName>');
settings.foo = bar;
cvr.initSettings(settings);

let result = await cvr.captureAsync('<image>', '<templateName>');