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

UPC/EAN Extension 2/5 does not read the 2/5 digit extension #551

Open
BillStrait opened this issue Feb 20, 2024 · 0 comments
Open

UPC/EAN Extension 2/5 does not read the 2/5 digit extension #551

BillStrait opened this issue Feb 20, 2024 · 0 comments

Comments

@BillStrait
Copy link

BillStrait commented Feb 20, 2024

I'm attempting to scan comic book/magazine bar codes. They look like this:
barcode3
My code looks like this:
string barcode = string.Empty;
using (var stream = file.OpenReadStream())
{

    try
    {
        stream.Seek(0, SeekOrigin.Begin);
        using var coreCompatImage = (Bitmap)Bitmap.FromStream(stream);
        var coreCompatReader = new ZXing.Windows.Compatibility.BarcodeReader();
        coreCompatReader.Options.PossibleFormats = new List<BarcodeFormat> { BarcodeFormat.UPC_A, 
BarcodeFormat.UPC_EAN_EXTENSION, BarcodeFormat.ITF };
         var coreCompatResult = coreCompatReader.Decode(coreCompatImage);
        var test = coreCompatReader.DecodeMultiple(coreCompatImage);
        barcode = coreCompatResult?.Text ?? string.Empty;
     }    
    catch (Exception exc)
    {
        return "Error processing the image: ";
    }
}
return barcode;

Test is an array with 1 item, even if UPC_EAN_EXTENSION is the only possible format provided. The one item is the 12 digits from the UPC_A format. I have used this image with a barcode scanner that is aware of the 5 digit extension, and get the correct code back, which leads me to suspect it's a problem with my implementation or the library.

I appreciate the help

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

1 participant