Quantcast
Channel: ZXing.Net
Viewing all 1871 articles
Browse latest View live

New Post: Some Qr codes cannot decode and QRCodeMultiReader not working

$
0
0
Hi,

I am using ZXing library to decode Qr codes in jpg images converted from pdf file. I found that some Qr codes decoded result were null. I set the option TryHarder to true, but didn't work.

Below is my code snippet:
byte[] data = null;

using (FileStream fs = new FileStream(ImgList[idx], FileMode.Open))
{
      data = new byte[fs.Length];
      fs.Read(data, 0, data.Length);
 }
                        
Result res = null;
using (MemoryStream ms = new MemoryStream(data))
{
     byte[] ImgByte = ms.ToArray();
     using (Bitmap bmp = (Bitmap)System.Drawing.Image.FromStream(ms))
     {
          IBarcodeReader bCodeReader = new BarcodeReader();
          bCodeReader.Options.TryHarder = true;
          res = bCodeReader.Decode(bmp);
     }
}
Also, some of the images contains more than one Qr codes, I tried QRCodeMultiReader code found here: TEXT, but only one Qr code was decoded and the rest were not decoded.

Does anyone has problems described above and found the solutions? Any help would be appreciated.
Thanks

New Post: Powershell Decoder Sample

$
0
0
You can now use Add-Type, instead of Reflection.Assembly.
Add-Type -Path (Join-Path $PSScriptRoot 'zxing.dll')
$reader = New-Object ZXing.BarcodeReader
$bitmap = [System.Drawing.Bitmap]::FromFile('C:\path\to\image.png')
$result = $reader.Decode($bitmap)
$result
For me, System.Drawing did not need to be explicitly loaded. If it did, one would use:
Add-Type -AssemblyName System.Drawing

New Post: Powershell Decoder Sample

$
0
0
This works ok in v3 and later, however; I did experience inconsistent problems with function calls from the DLL when loaded in this way for v2.

Overall, I have had significant difficulty getting Powershell to use the ZXing library properly in V2.

The above code will work for a default option basic QRCode read, however; if you need to change options I have yet to discover an easy way of passing those parameters natively/semi-natively without defining the IDictionary Object fully first in a C# code block and then dynamically compiling it at runtime.

It seems Powershell v2 simply cannot create strongly-typed Custom Dictionary Object members, and it handles Enumeration Types only slightly less poorly.

All variations of New-Object where it is not defined below as 2[], Powershell cannot find the Type with the library loaded.
Every variation I could think of below would find the type, but could not convert System.Object[] to System.String <<< ComObject

The code below assumes both the ZXing.dll and System.Collections.Generic.* have been loaded with Add-Type or through Reflection.
$IDict = New-Object "System.Collections.Generic.Dictionary
2[[ZXing.DecodeHintType, zxing.dll],[System.Collections.Generic.List[System.Object],mscorlib.dll]]"

New Post: Samsung Galaxy Ace 4 Autofocus Issue

$
0
0
When scanning barcodes with a Galaxy Ace 4, after 3 or 4 barcodes are decoded, the screen on the device goes black. The only way to get the app working again is to stop and restart. This happens when I use the SDK to build the scanner control directly into the Android application. The problem does not occur on any of the other devices. Looking deeper, if I install the stand alone ZXing barcode reader (downloaded from the Play Store), the same is true, however if I change the settings to turn the 'Auto Focus' off, the app works fine. Does anyone know if it is possible to turn off the Autofocus for the SDK version?

New Post: Special charaters in Code128

$
0
0
Hello,
i would like to include tabs (char(9)) in an Code128 Barcode. But it fail with an exception message.

System.ArgumentException: Bad character in input:

Needless to say that it works like a charm without the tabulator character.

Here is my testcode:
Class MainWindow
    Public Function GetBarCodeHorizontal(ByVal s As String, ByVal width As Integer) As Byte()
        Dim writer As New ZXing.BarcodeWriter()
        Dim ms As System.IO.MemoryStream = New System.IO.MemoryStream()

        writer.Format = ZXing.BarcodeFormat.CODE_128
        writer.Options = New ZXing.Common.EncodingOptions
        writer.Options.Width = width
        writer.Options.Height = 60
        writer.Options.PureBarcode = False
        'writer.Options.Hints.Add(ZXing.EncodeHintType.CHARACTER_SET, "UTF-8")

        Dim bmp As System.Drawing.Bitmap = writer.Write(s)

        bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png)
        Dim imagedata As Byte()
        imagedata = ms.GetBuffer()
        Return imagedata
    End Function


    Private Sub MainWindow_OnLoaded(sender As Object, e As RoutedEventArgs)
        Try
            Dim barCodeHorizontal = GetBarCodeHorizontal("3999999   80  1XXXXXX8    r1XX3", 200)
        Catch ex As Exception
            Console.WriteLine(ex)
        End Try
    End Sub
End Class
Thank you for your help.
Regards, Xenolith

New Post: Quick way to detect if image contains QR code

$
0
0
Hi,

If there is any quick way how to detect if scanned image contains QR code. My idea is if image contains QR code only then decode, if doesn't skip and take next image.

Thanks,

New Post: Aztec barcode encoder size limit

$
0
0
1000 bytes seems to be the size limit of data you can encode using the zxing aztec barcode library. Is there a version of this library that can encode up to 1914 bytes without losing data?

Created Unassigned: Camera Issue when Resuming on Windows Phone [13429]

$
0
0
We have the following issues on our Windows Phone application when using the ZXing scanner.

Scenario:
* We have the scanner open
* We press the Power button, so the phone goes into Sleep Mode
* We then resume the app again
* Scanner does not work when opening the page again

From a look at the code it seems that while trying to restore the application's preserved state, it sets up the complete scanning page, and then closes it again. I think the problem lies here.

When you try to open the page again, the camera does not get initialized properly again.

We are using the latest version found on Nuget, namely ZXing.Net.Mobile.1.5.4.0

Steps to replicate issue:
* Open ZXing Windows Phone test app found
* Open a scan-screen
* Sleep phone
* Resume
* Open scan-screen

Result:
* Scanner does not work

I did the following test, which seemed to solve the problem:
In ZXingScannerControl.cs:
* StartScanning method gets executed and creates a reader while resuming the app
* I skipped the execution of this method when the app was resuming (put a breakpoint on the entry line and dragged it to the end of the method, so that no _reader init happens)
* When navigating to the scan-screen after resuming/restoring was completed, the camera gets properly initialised and the scanner works again.

So something simple like:

//pseudo code
public void StartScanning()
{
if (isAppResuming)
return;

should solve the problem.

I am just not sure how to properly get whether the application is resuming.

Hopefully this can be rectified quickly.

Thanks

Dieter

New Post: QRCode detection on Kinect

$
0
0
Hi guys,

It seems that zxing.kinect only works for the earlier version of kinect but not kinect v2. Is there a way to implement zxing on the kinect v2?

Thanks!

New Post: PDF 417 Encoding error on Universal App

$
0
0
Hello,

I'm receiving the exception The type initializer for 'ZXing.PDF417.Internal.PDF417HighLevelEncoder' threw an exception. related to a CP437 encoding when I try to encode a PDF417 barcode on a universal app for windows 10.

I saw a solution you gave in this URL https://github.com/Redth/ZXing.Net.Mobile/issues/109. But when I try to change the encoding to UTF-8, I receive the same exception.

I'm doing this way:
BarcodeWriter writer = new BarcodeWriter();

writer.Format = BarcodeFormat.PDF_417;
writer.Options.Width = 1280;
writer.Options.Height = 350;
writer.Options.Hints.Add(EncodeHintType.DISABLE_ECI, true);
writer.Options.Hints.Add(EncodeHintType.CHARACTER_SET, "UTF-8");

var barcodeImage = writer.Write(code);
What am I doing wrong?

Thank you

New Post: Decoding micro QR

$
0
0
Hi, does ZXing support Micro QR?

New Post: Set Module Size

New Post: Scan Code-128 for Windows Phone 8.1

$
0
0
Hey Guys,

I am currently working on a Windwos Phone 8.1 App. I want to scan Code-128 barcodes with the usage of ZXing.Net 0.14.0.1. My implementation manages to scan QR-Codes, but it dosen´t recognize Code-128, or any other barcodes I tried to scan.
I read some discussions on here but I´m still not sure, if this is even implemented for WP8.1. So my Question is: Can I scan Code-123 and is there a sample?

Thanks for your Help

Alex

New Post: Data Matrix with dots (lasermarking)

$
0
0
Hi all,

is there a way to decode a data matrix code with dots instead of squares like they are created by laser marking?

Kind regards
Philip

New Post: Reading multiple barcodes VB.net

$
0
0
Please help me with reading multiple barcodes from an image. I have the following code which works fine for 1 barcode but I need te read multiple (about 10 per image):

'Code start
Imports ZXing
Imports ZXing.Common
Imports ZXing.Rendering

    Private Sub PrintBarcodes(image As Bitmap)
        Dim reader As IBarcodeReader = New BarcodeReader()
        Try
            Dim barcodeBitmap = DirectCast(image, Bitmap)
            Dim result = reader.Decode(barcodeBitmap)
            If result IsNot Nothing Then
              'some code
            End If
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try

    End Sub
'end code

I think it is something simple but I cant find any documentation.

Please help.

Many thanks in advance.

New Post: Reading multiple barcodes VB.net

$
0
0
Imports ZXing.Multi

    Private Sub PrintBarcodes(image As Bitmap)
        Dim reader As IMultipleBarcodeReader = New BarcodeReader()
        Try
            Dim results = reader.DecodeMultiple(image)
            If results IsNot Nothing Then
                For Each result As Object In results
                    'code
                Next
            End If
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
        End Try

    End Sub

New Post: Reading multiple barcodes VB.net

$
0
0
Hi Roossien,

I have found a way of dealing with reading multiple qr codes from an image which might be helpful to you reading multiple barcodes from an image. You need to cover scanned barcodes with filled rectangles in an image, save the image and rescan the other barcodes. You will need to loop to do this.

New Post: advanced barcode manipulation on thermal printers for industrial

$
0
0
I need to print different barcodes with different symbologies on industrial printers .
Until now I used the native printer languages ( Zebra , Intermec , sato , datamax , cab , thoshiba etc ).
With so many different printers i'm considering gdi printing mode.
Now, since the industrial printers have poor resolution 203 or 300 dpi, i need to manipulate the minimum size of the bar code 128 .
the output image will be black and white 1 bit.
Also I can not use the FNC1 character to become cod128 EAN128; zxing return invalid character error and i don't found in manual any method or function.
For example I can not print a ( 01 ) 80345678901234 ( 10 ) 1122334 ( 3103 ) 012345
Ean 128 barcode.
Any idea ?

Created Unassigned: 'System.ArgumentException' in zxing.dll or IndexOutOfRangeException [13435]

$
0
0
With only these attached images I get the System.IndexOutOfRangeException System.ArgumentException' using the method Decode with this snippet

BarcodeReader barcodeReader = new BarcodeReader()
{
AutoRotate = true,
Options = new DecodingOptions
{
TryHarder = true,
PureBarcode = false,
PossibleFormats = new BarcodeFormat[] { BarcodeFormat.QR_CODE, }
}
};

result = barcodeReader.Decode(graphicsImage);

Everything is working fine with other images.

New Comment on "Documentation"

$
0
0
Had to comment and say think you for this! Integrated into my windows application in a couple of hours and and generating codes no problem, and was not forced to hand over cash for private versions that do not do the job half as well as this library.
Viewing all 1871 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>