Comparison of barcode scanner libraries
Tags: programming, webdev, barcode, scanner
Published: 2023-04-18 09:38:15

I was working on a web application that needed a barcode scanner that would work on all devices and platforms.

5 powerful libraries were selected. Three paid and two free.
Let's look at their main characteristics and highlight the pros and cons.
To compare how accurately they recognize the barcode, I chose different products with codes of different sizes and scanned them one by one without paying attention to the lighting.
For the experiment, I used two browsers on a 2011 Macbook and two browsers on an Android phone.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/s9znjuljhpqvown299dj.jpg)

The results were evaluated on a 4-point scale and displayed in the table.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gmv9ypbbevsf57ungivf.png)


## [@ericblade/quagga2](https://www.npmjs.com/package/@ericblade/quagga2)

- Free
- Weekly Downloads - 16000
- The new version of quagga is just now being developed and maintained
- Works well, but needs tweaking and testing
- Many different settings, integrates quickly

Since it is free, it also showed itself poorly in tests, worse than the rest
You can try it [here](https://serratus.github.io/quaggaJS/v1.0.0-beta.1/examples/multiple/)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/obt1uzvcy17qq39tgdkw.png)

## [html5 qrcode](https://www.npmjs.com/package/html5-qrcode)
[You can test it here](https://scanapp.org/#reader)
- Weekly Downloads - 12000
- Free
- Big community
- Powerful enough
- Easy to implement
- Flexible setup


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cgxawpm2rr46vzkvhxwf.png)

## [dynamsoft-javascript-barcode](https://www.dynamsoft.com/barcode-reader/sdk-javascript/)
[https://www.npmjs.com/package/dynamsoft-javascript-barcode](https://www.npmjs.com/package/dynamsoft-javascript-barcode)
**Cons**: paid
10,000 barcode scan bundle - $1,249
50,000 barcode scan bundle - $2,999
100,000 barcode scan bundle - $4,999

- At first glance, less flexible, but everything you need is out of the box.
- It takes a little longer to set up than other paid options.
- Weekly Downloads - 9000
- It's solutions for various platforms and languages and supports many different code formats.
- 7-day free period to try
- You can test it [here](https://demo.dynamsoft.com/barcode-reader-js/)
- Actually, it doesn't work in Safari version 13 and below. But such users are less than 0.5%.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/alwxfnhsjc1z9xt71xba.png)

## [scanbot.io](https://scanbot.io)
**Cons**

- Paid: $25,000 per year
- A young library, so I did not pay attention to it.
- They have not had time to promote it yet, so a very small community. There are few stars on GitHub. And few downloads.
- Large library size

**Pros**
- There is a [demo](https://scanbot.io/en/sdk/demo/web-sdk#test) where you can test 
- There is a trial license for 7 days.
- With many versions for different devices, it is frequently updated and supported.
- It works fast enough, not inferior to scandit-sdk. But there are no on-screen prompts and there is a little lack of interactivity.

Although it performed best in the tests, I would put it in second place.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kchvr5588ni95chfy8nf.png)

And the Oscar goes...

## [scandit-sdk](https://www.scandit.com/products/barcode-scanning/)
[https://www.npmjs.com/package/scandit-sdk](https://www.npmjs.com/package/scandit-sdk)
**Cons**: Paid solution, $25,000 per year

**Pros**

- It is a popular library
- Weekly Downloads - 47,000
- Easy to implement, with many functions out of the box
- Maybe not be as flexible as quagga2, but powerful and works with different kinds of codes.
- There are solutions for different platforms
- Showed good results in tests.
- You can test it [here](https://websdk.scandit.com)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ivmhua0d39i7diah006o.png)

## Conclusion

Everything very much depends on the camera, device, browser, lighting, code size, and quality.
Of course, paid ones work faster, more reliably, and better, but free ones are also not much inferior to them.
Scandit-sdk seemed to me the best lib, it recognized the maximum number of codes on all devices and dealt with them very quickly. It is flexible but also expensive.

Other paid options showed no worse results and also deserve attention.

Among the free options, the Html5-code lib showed itself better, on Android in Chrome it was almost as good as paid solutions, but showed itself a little worse.
Of the four, Quagga2 screwed up the most. Although it is flexibly configured and looks good, it recognized the codes the least of all.

The article does not claim objectivity. The list of libraries may not be complete, so if you know of other libraries, feel free to comment.