Closed joseph-animasds closed 5 years ago
Please share the image you are trying to use.
I am sorry but I still cannot see the barcode image. :(
Attachment to email might not work, please attach image here.
Attachment to email might not work, please attach image here.
Email does not show any image.
@joseph-animasds please donot post image via email, it does not work. Instead visit this link and drag n drop image to add it to comment, please. https://github.com/mubaidr/Javascript-Barcode-Reader/issues/272
Here is image
Sorry for inconvenience. I will look into this matter soon.
Im also trying this image which is higher resolution. It works using this tool https://demo.dynamsoft.com/DBR/BarcodeReaderDemo.aspx but with this package it does not work
@mubaidr - any update yet?
For the above image: Expected: "33c64780-a9c0-e92a-820c-fae7011c11e2" Received: "33ETX4780-SOH9ETX0-ENQ2SOH80ETX-SOHENQ70111ENQ2"
Looks like this package is not decoding code-128 properly. I am working on it.
Interesting: So if I try to use this online service to generate image for same code, it is extracted by this package as expected.
https://barcode.tec-it.com/en/?data=33c64780-a9c0-e92a-820c-fae7011c11e2
@mubaidr - I first have a pdf that I convert with linux: pdftoppm test.pdf test -png -f 1 -singlefile -rx 300 -ry 300 then I crop that image and run this javascript-barcode-reader: ` const express = require('express') const app = express() const port = 3000 const sharp = require('sharp'); const javascriptBarcodeReader = require('javascript-barcode-reader')
app.get('/', (req, res) => { let originalImage = 'pdf/test.png' // file name for cropped image let croppedImage = 'croppedImage/croppedImage.png';
sharp(originalImage).extract({ width: 1114, height: 105, left: 789, top: 3189 }).toFile(croppedImage)
.then(new_file_info => {
console.log("Image cropped and saved", new_file_info);
javascriptBarcodeReader(
croppedImage /* Image file Path || {data: pixelArray, width, height} || HTML5 Canvas ImageData */,
{
barcode: 'code-128',
type: 'industrial', //optional type
}
)
.then(code => {
console.log(code)
})
.catch(err => {
console.log(err)
})
}).catch(err => console.log(err, "something failed"))
})
app.listen(port, () => console.log(listening on ${port}
))
`
@mubaidr - the image is a little blurry when I zoom in. I think that is why.
Actually i have compared two images using an online image difference tool. Looks like there are atleast two portions in your provided image which are different than the above generated Image (uploaded by me). So i think it is related to some encoding configuration.
@mubaidr - Are you working on a fix then?
Yes, I am working on it. Stay tuned!
Fixed in: https://github.com/mubaidr/Javascript-Barcode-Reader/commit/7536e9882c51717b20d96fe38364b3135034729b
You may still note that some characters cannot be identified, this is due to image degradation issue. I will be adding feature to pre-process image to enhance its precision. You can follow it up here: https://github.com/mubaidr/Javascript-Barcode-Reader/issues/250
Describe the bug When reading a png image of only the barcode and using the code-128 decoder, An error is thrown "Failed to extract barcode" Here is my code:
Here is the error:
Desktop (please complete the following information):