Read multiple barcode from a single image using php or javascript

2.7k views Asked by At

Is there any way to scan multiple bar-codes from a single image at a time using PHP or JavaScript. I have googled, but can scan only single barcode from an image.

I have tried this code : https://gist.github.com/tobytailor/421369

1

There are 1 answers

0
Hughesthe1st On

You could also use a Barcode Recognition API like the one from HP IDOL OnDemand (I work for HP). I ran the image above through the online console for a quick test and was able to extract the following information from the image file...

{
  "barcode": [
    {
      "text": "CODE128",
      "barcode_type": "code-128",
      "left": 1498,
      "top": 552,
      "width": 598,
      "height": 262,
      "additional_information": {}
    },
    {
      "text": "CODE39",
      "barcode_type": "code-39",
      "left": 300,
      "top": 552,
      "width": 768,
      "height": 262,
      "additional_information": {}
    },
    {
      "text": "0012345678905",
      "barcode_type": "ean-13",
      "left": 1480,
      "top": 1466,
      "width": 619,
      "height": 260,
      "additional_information": {
        "country": "U.S. and Canada"
      }
    },
    {
      "text": "1234567890128",
      "barcode_type": "ean-13",
      "left": 366,
      "top": 1922,
      "width": 584,
      "height": 260,
      "additional_information": {
        "country": "U.S. (reserved for later use)"
      }
    },
    {
      "text": "01234565",
      "barcode_type": "ean-8",
      "left": 1696,
      "top": 2022,
      "width": 390,
      "height": 160,
      "additional_information": {}
    },
    {
      "text": "012345",
      "barcode_type": "codabar",
      "left": 300,
      "top": 1010,
      "width": 672,
      "height": 260,
      "additional_information": {}
    },
    {
      "text": "CODE93",
      "barcode_type": "code-93",
      "left": 300,
      "top": 1466,
      "width": 730,
      "height": 260,
      "additional_information": {}
    },
    {
      "text": "00123456",
      "barcode_type": "i25",
      "left": 1501,
      "top": 1010,
      "width": 264,
      "height": 260,
      "additional_information": {}
    },
    {
      "text": "00",
      "barcode_type": "i25",
      "left": 1394,
      "top": 1029,
      "width": 242,
      "height": 242,
      "additional_information": {}
    }
  ]
}