ZXing ("Zebra Crossing") barcode scanning library for Java, Android

Overview

Project in Maintenance Mode Only

The project is in maintenance mode, meaning, changes are driven by contributed patches. Only bug fixes and minor enhancements will be considered. The Barcode Scanner app can no longer be published, so it's unlikely any changes will be accepted for it. There is otherwise no active development or roadmap for this project. It is "DIY".

Get Started Developing

To get started, please visit: https://github.com/zxing/zxing/wiki/Getting-Started-Developing

ZXing ("zebra crossing") is an open-source, multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages.

Supported Formats

1D product 1D industrial 2D
UPC-A Code 39 QR Code
UPC-E Code 93 Data Matrix
EAN-8 Code 128 Aztec
EAN-13 Codabar PDF 417
UPC/EAN Extension 2/5 ITF MaxiCode
RSS-14
RSS-Expanded

Components

Active

Module Description
core The core image decoding library, and test code
javase JavaSE-specific client code
android Android client Barcode Scanner
android-integration Supports integration with Barcode Scanner via Intent
android-core Android-related code shared among android, other Android apps
zxingorg The source behind zxing.org
zxing.appspot.com The source behind web-based barcode generator at zxing.appspot.com

Available in previous releases

Module Description
cpp C++ port
iphone iPhone client
objc Objective C port
actionscript Partial ActionScript port
jruby JRuby wrapper

ZXing-based third-party open source projects

Module Description
QZXing port to Qt framework
glassechidna/zxing-cpp port to C++ (forked from the deprecated official C++ port)
nu-book/zxing-cpp recent port to C++
zxing_cpp.rb bindings for Ruby (not just JRuby), powered by zxing-cpp
jsqrcode port to JavaScript
python-zxing bindings for Python
ZXing .NET port to .NET and C#, and related Windows platform
php-qrcode-detector-decoder port to PHP
ZXing Delphi Port to native Delphi object pascal, targeted at Firemonkey compatible devices (IOS/Android/Win/OSX) and VCL.
ZXingObjC Port to Objective-C
php-zxing PHP wrapper to Zxing Java library
zxing-js/library TypeScript port of ZXing library
pyzxing Python wrapper to ZXing library

Other related third-party open source projects

Module Description
Barcode4J Generator library in Java
ZBar Reader library in C99
OkapiBarcode

Links

Contacting

Post to the discussion forum or tag a question with zxing on StackOverflow.

Etcetera

Build Status Coverity Status codecov.io Codacy Badge

QR code is trademarked by Denso Wave, inc. Thanks to Haase & Martin OHG for contributing the logo.

Optimized with JProfiler

Issues
  • Java Exception: java.lang.IllegalStateException: Failed to recover - encoded with PDF_417 in 110x166

    Java Exception: java.lang.IllegalStateException: Failed to recover - encoded with PDF_417 in 110x166

    Hi .

    Using jazzer, the following exception has been occurred :

    Java Exception: java.lang.IllegalStateException: Failed to recover .

    The produced jazzer file is as :

    
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    public class Crash_554492f3abaea0e383717bff996d44d0cdb12f5f {
        static final String base64Bytes = "rO0ABXNyABNqYXZhLnV0aWwuQXJyYXlMaXN0eIHSHZnHYZ0DAAFJAARzaXpleHAAAAADdwQAAAADc3IAEWphdmEubGFuZy5JbnRlZ2VyEuKgpPeBhzgCAAFJAAV2YWx1ZXhyABBqYXZhLmxhbmcuTnVtYmVyhqyVHQuU4IsCAAB4cAAAAG5zcQB+AAIAAACAdAAAeA==";
    
        public static void main(String[] args) {
            ClassLoader.getSystemClassLoader().setDefaultAssertionStatus(true);
            try {
                Method fuzzerInitialize = MultiFormatEncodeFuzzer.class.getMethod("fuzzerInitialize");
                fuzzerInitialize.invoke(null);
            } catch (NoSuchMethodException ignored) {
                try {
                    Method fuzzerInitialize = MultiFormatEncodeFuzzer.class.getMethod("fuzzerInitialize", String[].class);
                    fuzzerInitialize.invoke(null, (Object) args);
                } catch (NoSuchMethodException ignored) {
                } catch (IllegalAccessException | InvocationTargetException e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            } catch (IllegalAccessException | InvocationTargetException e) {
                e.printStackTrace();
                System.exit(1);
            }
            com.code_intelligence.jazzer.api.CannedFuzzedDataProvider input = new com.code_intelligence.jazzer.api.CannedFuzzedDataProvider(base64Bytes);
            MultiFormatEncodeFuzzer.fuzzerTestOneInput(input);
        }
    }
    
    
    

    And the corpus required to reproduce (Please first unzip it) :

    crash-corpus.zip

    To reproduce :

    ./MultiFormatEncodeFuzzer [crashing-corpus] Thanks!

    opened by Microsvuln 5
  • IndexOutOfBounds when encoding a PDF417

    IndexOutOfBounds when encoding a PDF417

    I'm trying to encode a PDF417 and whenever I set the PDF417_COMPACTION to Compaction.TEXT I get this crash:

        java.lang.ArrayIndexOutOfBoundsException: length=128; index=8226
            at com.google.zxing.pdf417.encoder.PDF417HighLevelEncoder.isMixed(PDF417HighLevelEncoder.java:456)
            at com.google.zxing.pdf417.encoder.PDF417HighLevelEncoder.encodeText(PDF417HighLevelEncoder.java:298)
            at com.google.zxing.pdf417.encoder.PDF417HighLevelEncoder.encodeHighLevel(PDF417HighLevelEncoder.java:185)
            at com.google.zxing.pdf417.encoder.PDF417.generateBarcodeLogic(PDF417.java:649)
            at com.google.zxing.pdf417.PDF417Writer.bitMatrixFromEncoder(PDF417Writer.java:107)
            at com.google.zxing.pdf417.PDF417Writer.encode(PDF417Writer.java:87)
            at com.google.zxing.MultiFormatWriter.encode(MultiFormatWriter.java:102)
    

    Here is the code for how I am trying to create the barcode:

            var hints: MutableMap<EncodeHintType, Any>?
            
            hints = EnumMap<EncodeHintType, Any>(EncodeHintType::class.java)
            
            hints[EncodeHintType.CHARACTER_SET] = "UTF-8" 
            hints[EncodeHintType.ERROR_CORRECTION] = 6
            hints[EncodeHintType.PDF417_COMPACTION] = Compaction.TEXT
            
            val writer = MultiFormatWriter()
            val result: BitMatrix
            try {
                result = writer.encode(contents, format, img_width, img_height, hints)
            } catch (iae: WriterException) {
                // Unsupported format
                return null
            }
    

    Is this a bug or am i doing something wrong?

    bug 
    opened by Doophie 8
  • Corner-case bug in Reed Solomon code?

    Corner-case bug in Reed Solomon code?

    Hi,

    First, thanks for this great library. I'm just using the Reed Solomon part of it and I stumbled on I think a corner-case bug.

    When using data+error_codes of size 256, if I corrupt the first byte (after ReedSolomon encoding), neither the byte is "repaired" nor an exception is thrown when decoding. It doesn't seem to matter how many error_codes I use or the data content, but it only fails for data+error_codes of size 256.

    I grep'd the ReedSolomon code for literals 255 and 256 but saw nothing fishy.

    Hmm, code formatter on this wiki not working for me. JUnit test below. Depends on RSEncoderDecoder class, which looks fine by inspection (attached as '.txt') RSEncoderDecoder.txt

    import java.util.Arrays; import org.junit.Test; import com.casualcoding.reedsolomon.RSEncoderDecoder; public class ReedSolomonByte0Bug { @Test public void testRSStreamAllZeros() throws Exception { /* * numEcBytes doesn't seem to matter */ int numEcBytes = 8;

        for (int totalBlockSizeBytes = 10; totalBlockSizeBytes <= 256; totalBlockSizeBytes++)
        {
    
            byte[] mesg = new byte[totalBlockSizeBytes - numEcBytes];
    
            for (int i = 0; i < mesg.length; i++)
            {
                mesg[i] = (byte) i;
            }
    
            RSEncoderDecoder rs = new RSEncoderDecoder();
            byte[] rsmesg = rs.encodeData(mesg, numEcBytes);
    
            /*
             * Corrupt byte 0.  Corrupting other bytes works correctly
             */
            rsmesg[0] = (byte) (rsmesg[0] + 1);
    
            // No exception thrown ...
            byte[] testDecode = rs.decodeData(rsmesg, numEcBytes);
    
            /*
             * Fails for totalBlockSize = 256
             */
            if (Arrays.equals(mesg, testDecode) == false)
            {
                System.out.println("Failed: totalBlockSizeBytes = " + totalBlockSizeBytes);
            }
        }
    }
    

    }

    bug 
    opened by nasamaher 2
  • CommandLineEncoder appears to ignore the height and width parameters when barcode_format is  DATA_MATRIX

    CommandLineEncoder appears to ignore the height and width parameters when barcode_format is DATA_MATRIX

    CommandLineEncoder appears to ignore the height and width parameters when barcode_format is DATA_MATRIX

    The following command produces a 14px by 14px image instead of a 500px by 500px image:

    java -cp javase/target/javase-3.3.0-jar-with-dependencies.jar com.google.zxing.client.j2se.CommandLineEncoder --barcode_format DATA_MATRIX --height 500 --width 500 abcdefg
    

    Here's a Dockerfile to reproduce this issue:

    FROM ubuntu:16.04
    RUN apt-get update && apt-get install -y --no-install-recommends default-jdk git maven
    RUN git clone --depth 1 --branch zxing-3.3.0 https://github.com/zxing/zxing.git
    RUN cd zxing && mvn install -DskipTests
    RUN cd zxing/javase && mvn -DskipTests package assembly:single
    RUN cd zxing && java -cp javase/target/javase-3.3.0-jar-with-dependencies.jar com.google.zxing.client.j2se.CommandLineEncoder --barcode_format DATA_MATRIX --height 500 --width 500 abcdefg
    

    Is this a bug or am I using CommandLineEncoder wrong?

    enhancement 
    opened by ablegreen 4
  • Illegal Character Exception

    Illegal Character Exception

    Hi everyone,

    i always get a illegal character exception if i try to create a DataMatrix with following code

    HashMap<EncodeHintType, Object> options = new HashMap<>();
    options.put(EncodeHintType.DATA_MATRIX_SHAPE, SymbolShapeHint.FORCE_SQUARE);
    
    int width = 128;
    int height = 128;
    String content = "test TE>240 2 I.E ST>300";
    
    BitMatrix bitMatrix = new DataMatrixWriter().encode(content, BarcodeFormat.DATA_MATRIX, width, height, options)
    

    Stacktrace

    java.lang.IllegalArgumentException: Illegal character: . (0x002e)
        at com.google.zxing.datamatrix.encoder.HighLevelEncoder.illegalCharacter(HighLevelEncoder.java:445)
        at com.google.zxing.datamatrix.encoder.X12Encoder.encodeChar(X12Encoder.java:65)
        at com.google.zxing.datamatrix.encoder.X12Encoder.encode(X12Encoder.java:34)
        at com.google.zxing.datamatrix.encoder.HighLevelEncoder.encodeHighLevel(HighLevelEncoder.java:182)
        at com.google.zxing.datamatrix.DataMatrixWriter.encode(DataMatrixWriter.java:84)
        at com.google.zxing.Writer$encode.call(Unknown Source)
    

    Is this a bug or i'm missing something?

    bug 
    opened by bomski 5
  • Barcode Scanner: Decoding of multiple iCal/ics whole-day VEVENTs fails for second and further events

    Barcode Scanner: Decoding of multiple iCal/ics whole-day VEVENTs fails for second and further events

    Hello, I generated a QR code from the following whole-data-events in ics format.

    Bug

    • The current Zxing Barcode Scanner on Android detects only the first event (20151012)
    • but fails to detect/decode the further events.
    BEGIN:VCALENDAR
    PRODID:Leave Planner Version 201512041000
    COMMENT:5 day/s exported on 20151204
    VERSION:2.0
    BEGIN:VEVENT
    SUMMARY:XLEAVE
    DTSTART;VALUE=DATE:20151012
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:XLEAVE
    DTSTART;VALUE=DATE:20151013
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:XLEAVE
    DTSTART;VALUE=DATE:20151014
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:XLEAVE
    DTSTART;VALUE=DATE:20151015
    END:VEVENT
    BEGIN:VEVENT
    SUMMARY:XLEAVE
    DTSTART;VALUE=DATE:20151016
    END:VEVENT
    END:VCALENDAR
    

    here's the code to generate with your online web side:

    https://zxing.org/w/chart?cht=qr&chs=350x350&chld=L&choe=UTF-8&chl=BEGIN%3AVCALENDAR%0APRODID%3ALeave+Planner+Version+201512041000%0ACOMMENT%3A5+day%2Fs+exported+on+20151204%0AVERSION%3A2.0%0ABEGIN%3AVEVENT%0ASUMMARY%3AXLEAVE%0ADTSTART%3BVALUE%3DDATE%3A20151012%0AEND%3AVEVENT%0ABEGIN%3AVEVENT%0ASUMMARY%3AXLEAVE%0ADTSTART%3BVALUE%3DDATE%3A20151013%0AEND%3AVEVENT%0ABEGIN%3AVEVENT%0ASUMMARY%3AXLEAVE%0ADTSTART%3BVALUE%3DDATE%3A20151014%0AEND%3AVEVENT%0ABEGIN%3AVEVENT%0ASUMMARY%3AXLEAVE%0ADTSTART%3BVALUE%3DDATE%3A20151015%0AEND%3AVEVENT%0ABEGIN%3AVEVENT%0ASUMMARY%3AXLEAVE%0ADTSTART%3BVALUE%3DDATE%3A20151016%0AEND%3AVEVENT%0AEND%3AVCALENDAR%0A

    enhancement 
    opened by Wikinaut 4
  • DataMatrix decoder do not support unicode text

    DataMatrix decoder do not support unicode text

    Hi there! I've discovered, that zxing (a least, android barcode scanner) decodes DataMatrix codes with unicode text as ASCII (and, so brake it). I.e. it displays ÑеÑÑ instead of тест (ciryllic "test").

    OTOH, QR-encoded unicode is decoded fine.

    Can somebody fix that (or, at least, advice/guide me how to fix it)?

    bug 
    opened by msva 17
  • MECARD / vCard encoding should delimit fields

    MECARD / vCard encoding should delimit fields

    Address / city / state / postal code and so on are supposed to be separated in MECARD and vCard, by comma and semicolon, respectively. The code right now doesn't break this down beyond an address field though, so isn't able to format accordingly.

    Ideally the online encoder would have separate fields for address components. And, in Android, would retrieve address elements independently. However I am not sure Android breaks this out either, not via Intent.

    Ported from https://code.google.com/p/zxing/issues/detail?id=1468

    bug 
    opened by srowen 2
Releases(zxing-3.4.1)
Owner
ZXing Project
ZXing is an open-source, multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages.
ZXing Project
Java interface to OpenCV, FFmpeg, and more

JavaCV Commercial support: Introduction JavaCV uses wrappers from the JavaCPP Presets of commonly used libraries by researchers in the field of comput

Bytedeco 5.3k Sep 19, 2021
Fast computer vision library for SFM, calibration, fiducials, tracking, image processing, and more.

Table of Contents Introduction Cloning Repository Quick Start Gradle and Maven Building from Source Dependencies Help/Contact Introduction BoofCV is a

Peter Abeles 767 Sep 12, 2021
Traditional roguelike game with pixel-art graphics and simple interface

Traditional roguelike game with pixel-art graphics and simple interface

Evan Debenham 1.4k Sep 10, 2021
Simple Java image-scaling library implementing Chris Campbell's incremental scaling algorithm as well as Java2D's "best-practices" image-scaling techniques.

imgscalr - Java Image-Scaling Library http://www.thebuzzmedia.com/software/imgscalr-java-image-scaling-library/ Changelog --------- 4.2 * Added sup

Riyad Kalla 1.1k Aug 24, 2021
Pw0 Framewrok - magical android pentest app 🔮! Pixie Dust, Handshakes, Deauth, Nmap, Port scanner and more!

Pw0 Framework Pw0 Framewrok - magical android pentest app ?? ! Features: Pixie Dust Handshakes Deauth Nmap Port scanner and more! Version: 0.2 Beta Au

Huntmix 12 Sep 1, 2021
Roman Beskrovnyi 167 Sep 8, 2021
TwelveMonkeys ImageIO: Additional plug-ins and extensions for Java's ImageIO

About TwelveMonkeys ImageIO is a collection of plugins and extensions for Java's ImageIO. These plugins extend the number of image file formats suppor

Harald Kuhr 1.3k Sep 17, 2021
Thumbnailator - a thumbnail generation library for Java

March 11, 2021: Thumbnailator 0.4.14 has been released! See Changes for details. Thumbnailator is now available through Maven! What is Thumbnailator?

Chris Kroells 3.8k Sep 17, 2021
Java JNA wrapper for Tesseract OCR API

Tess4J A Java JNA wrapper for Tesseract OCR API. Tess4J is released and distributed under the Apache License, v2.0. Features The library provides opti

Quan Nguyen 1k Sep 16, 2021
VisionCamera Frame Processor Plugin to label images using MLKit Vision

vision-camera-image-labeler A VisionCamera Frame Processor Plugin to label images using MLKit Vision Image Labeling. Installation npm install vision-c

Marc Rousavy 46 Sep 14, 2021
This project allows the exchange of files between your local disk and a D64 image (Commodore 64 image disk) . Ce projet permet l'échange de fichiers entre votre disque local et une image D64 (Image de disquette du Commodore 64).

DiskToolC64 Ce projet permet l'échange de fichiers entre votre disque local et une image D64 (Image de disquette du Commodore 64). Introduction Les fi

Eddy BRIERE 3 May 13, 2021
Diagrams as code is a term used for storing the source of a diagram image as a text file.

Diagrams as code Diagrams as code is a term used for storing the source of a diagram image as a text file. Examples are architecture diagrams, or diag

null 18 Sep 10, 2021
图片/GIF/音频/点选验证码生成工具,可以自定义图片尺寸,字体,颜色,干扰项等等。

简介 captcha是一个图片/点选/音频验证码生成工具库。 1.调用ImageCaptchaUtil中的方法来生成验证码图片信息,支持返回图片byte[],base64字符串和base64Data字符串。可设置干扰线类型来生成不同干扰类型的验证码图片。可已自定义图片背景颜色,图片宽度高度,字体,字

牛长清 22 Sep 2, 2021
Custom Image Server for use with ShareX

rImageServer How to use: Normal Instalation: Download .jar Start: javar -jar [filename].jar Edit: imageserver.propierties Check if web works -> Go to

Ryzeon 13 Aug 27, 2021