Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsJul 23, 2026·3 min de lecture

ZXing — Open-Source Barcode and QR Code Processing Library

A multi-format 1D/2D barcode image processing library implemented in Java, with ports to other languages and a standalone Android barcode scanner app.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
ZXing
Commande d'installation directe
npx -y tokrepo@latest install 5942b2b3-86d7-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

ZXing (pronounced "zebra crossing") is the most widely used open-source barcode scanning library in the Java ecosystem. Originally created at Google, it supports decoding and encoding of over a dozen barcode formats and serves as the foundation for barcode scanning in countless Android apps and server-side processing pipelines.

What ZXing Does

  • Decodes 1D barcodes including UPC-A, UPC-E, EAN-8, EAN-13, Code 39, Code 128, and ITF
  • Decodes 2D barcodes including QR Code, Data Matrix, Aztec, and PDF 417
  • Generates barcode images programmatically for embedding in apps or documents
  • Provides a standalone Android scanner app with camera preview and auto-focus
  • Offers a pure Java core with no native dependencies for cross-platform use

Architecture Overview

The core library is pure Java and processes barcode recognition through a pipeline of image binarization, format-specific detector, and decoder stages. The Reader interface abstracts format detection, allowing the MultiFormatReader to try multiple formats in priority order. The Android integration layer handles camera preview frames and feeds them to the core decoder on a background thread.

Setup & Configuration

  • Add the zxing-core dependency for server-side or pure Java barcode processing
  • Use zxing-android-embedded for an integrated Android scanner with camera preview
  • Configure supported barcode formats via IntentIntegrator or DecodeHintType map
  • Adjust camera resolution and autofocus settings for scanning distance requirements
  • Use the BarcodeEncoder class for generating QR code or barcode bitmap images

Key Features

  • Supports 15+ barcode formats covering retail, logistics, and identification use cases
  • Pure Java implementation with no JNI or native code for maximum portability
  • Battle-tested in production across thousands of apps over more than a decade
  • Barcode generation API for creating scannable images from arbitrary data
  • Modular design separating core decoding from platform-specific camera integration

Comparison with Similar Tools

  • ML Kit Barcode Scanning — Google's ML-based scanner with better angle tolerance, but requires Google Play Services
  • Dynamsoft Barcode Reader — commercial SDK with higher accuracy on damaged barcodes; ZXing is free and open source
  • CameraX MLKit — Jetpack integration for barcode scanning; depends on ML Kit under the hood
  • Scandit — enterprise-grade commercial scanner; ZXing provides a solid free alternative for standard use cases
  • ZBar — C-based scanner with Python bindings; ZXing is Java-native and better suited for Android and JVM projects

FAQ

Q: Is ZXing still actively maintained? A: The core library is stable and receives occasional updates. Community forks like zxing-android-embedded provide active Android integration maintenance.

Q: Can I use ZXing for server-side barcode processing? A: Yes. The core module is pure Java and works on any JVM without Android dependencies.

Q: How do I improve scan speed for QR codes? A: Restrict the supported formats to only QR_CODE via DecodeHintType, which avoids trying all format decoders.

Q: Does it support scanning from image files? A: Yes. Pass a BufferedImage or luminance source to the MultiFormatReader to decode barcodes from static images.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires