Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quagga unable to read code generated from pdf to image #506

Open
redochka opened this issue Jul 30, 2024 · 2 comments
Open

Quagga unable to read code generated from pdf to image #506

redochka opened this issue Jul 30, 2024 · 2 comments

Comments

@redochka
Copy link

redochka commented Jul 30, 2024

I am extracting a barcode from a pdf using FPDF than converting it to an image using pdf.js

The barcode is readable by other bar code scanner tools. however quaggajs is not able to detect it.

I am using the basic nodejs example which works with other barcodes.

What could be wrong with a barcode found in a pdf and converted to an image?
output0
output_page-0001

@ericblade
Copy link
Collaborator

Hi there! Usually, the problem that I see is that there's zero whitespace around the image, which causes it to not understand where the barcode is. That doesn't appear to be the case here, but it is quite a large barcode, so I'm guessing resolutions may not be configured to handle this.

Can you provide your quagga configuration block? Also, which of these two images are we talking about? both?

@redochka
Copy link
Author

Hey,
yes problem happening with both images. The large image with lot of blank is just an experiment to see if it would help. My quagga config is basic:

Quagga.decodeSingle({
  // src         : "pwlo858qvoc2cgy6aqijt9ctmiszwqreypqlw7xu_page-0001.jpg",
  src         : "output0.png",
  numOfWorkers: 0,  // Needs to be 0 when used within node
  // inputStream : {
  //   size: 2000  // restrict input-size to be 800px in width (long-side)
  // },
  decoder     : {
    readers: [
      "code_128_reader",
      "ean_reader",
      "ean_8_reader",
      "code_39_reader",
      "code_39_vin_reader",
      "codabar_reader",
      "upc_reader",
      "upc_e_reader",
      "i2of5_reader",
      "2of5_reader",
      "code_93_reader",
    ], // List of active readers
    locate: true,
    debug: {
      drawBoundingBox: false,
      showFrequency: false,
      drawScanline: false,
      showPattern: false
    }

  },
}, function (result) {
  console.log("result", result);

  if (result && result.codeResult) {
    console.log("result.codeResult", result.codeResult);
    console.log("result", result.codeResult.code);
  } else {
    console.log("not detected");
  }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants