You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm attempting to scan comic book/magazine bar codes. They look like this:
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
The text was updated successfully, but these errors were encountered:
I'm attempting to scan comic book/magazine bar codes. They look like this:

My code looks like this:
string barcode = string.Empty;
using (var stream = file.OpenReadStream())
{
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
The text was updated successfully, but these errors were encountered: