schmich / instascan

HTML5 QR code scanner using your webcam
https://schmich.github.io/instascan/
MIT License
2.97k stars 864 forks source link

Scan from image ? #208

Open ternaryCat opened 5 years ago

ternaryCat commented 5 years ago

HI. Can i scan qr from just image, without webcam? Thanks!

marmxlab commented 5 years ago

Hi! Instascan does not expose any functions for you to do that. But you can use the QR code image processing library that is used by Instascan, which is called ZXing.

For TypeScript projects: https://aleris.github.io/zxing-typescript/

For JavaScript projects: https://github.com/kig/zxing-cpp-emscripten or https://github.com/zxing-js/library

marmxlab commented 5 years ago

Or you can modify the index.js to make it to expose the ZXing and then rebuild the Instascan

require('babel-polyfill');
require('webrtc-adapter');

var Instascan = {
  Scanner: require('./src/scanner'),
  Camera: require('./src/camera'),
  ZXing: require('./src/zxing')
};

module.exports = Instascan;

then run gulp or npx gulp and use the dist/instascan.js in your project