Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

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

Open
#551 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp

Research direction

Start by reproducing the problem: decode the attached comic barcode image with a BarcodeReader whose Options.PossibleFormats contains only UPC_EAN_EXTENSION, and compare the result with DecodeMultiple. The payload names no source files, so locate the UPC/EAN extension decoder yourself. Done means the 2-digit or 5-digit extension is returned, or the report is shown to be a usage error.

Written by the indexing model from the issue text.

Description

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

Dominant language
C#
Stars
3.1k
Forks
704
Avg merge
13d 17h
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from micjahn/ZXing.Net

All issues in micjahn/ZXing.Net

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.