How to use the jsqr.extractQRFromBinaryImage function in jsqr

To help you get started, we’ve selected a few jsqr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gruhn / vue-qrcode-reader / src / scanner.js View on Github external
export function scan (imageData, locateOnly) {
  let location = null
  let content = null

  const binaryImage = jsQR.binarizeImage(
    imageData.data,
    imageData.width,
    imageData.height
  )

  location = jsQR.locateQRInBinaryImage(binaryImage)

  if (location !== null && !locateOnly) {
    const qrcode = jsQR.extractQRFromBinaryImage(binaryImage, location)

    content = jsQR.decodeQR(qrcode)
  }

  return { location, content }
}

jsqr

A pure javascript QR code reading library that takes in raw images and will locate, extract and parse any QR code found within.

Apache-2.0
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis

Similar packages