パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.2.4

zxing2

Dartで実装された、複数フォーマットの1次元/2次元バーコード画像処理ライブラリです。これはAndroidライブラリのポートです。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
33.2万
いいね数
76
Pub ポイント
160

パッケージをインストール

flutter pub add zxing2

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

zxing2 は、ZXing バーコード処理ライブラリの Dart 実装であり、マルチフォーマットの 1D および 2D バーコードのスキャンと生成をサポートしています。人気のある Android ZXing ライブラリの移植版であり、Flutter アプリでクロスプラットフォームのバーコード機能を可能にします。このパッケージは Android、iOS、Web、macOS、Windows、Linux で動作し、さまざまなデバイス間で信頼性の高いバーコード読み取りと書き込みが必要なアプリケーションに最適です。

用途

  • モバイルアプリでQRコードをスキャンする
  • 在庫追跡用のバーコードを生成する
  • 小売アプリで製品コードを読み取る
  • Webアプリケーションにおけるバーコード入力の統合
  • バーコード付き文書のスキャンをサポート

主な機能

  • クロスプラットフォームのバーコードサポート
  • バーコード検出の高精度
  • 複数のフォーマット(QR、Data Matrix、PDF417など)をサポートしています
  • 軽量で高速処理
  • Flutter UI との簡単な統合

適している対象

  • バーコードスキャンが必要なモバイルおよびウェブアプリ
  • ECおよびロジスティクスアプリケーション
  • 在庫および資産管理ツール
  • バーコードを介した安全なデータエンコーディングを必要とするアプリ
  • 複数のプラットフォームでネイティブに近いパフォーマンスを求める開発者

注意事項

  • モバイルプラットフォームではカメラの権限が必要です
  • 低性能デバイス向けの最適化が必要になる可能性があります
  • 画像ベースのバーコード処理に限定
  • スキャン用の組み込みUIコンポーネントはありません
  • パフォーマンスは画像の品質と照明状態に依存します

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

zxing-dart

ZXing ("zebra crossing") is an open-source, multi-format 1D/2D barcode image processing library.
This package is a pure Dart port of the original Java library.

For now, it only supports QR-Code (encoding and decoding). New format can easily be added if this port proves useful.

pub package Build Status codecov

Buy Me A Coffee

Getting started

QR Code
Decoding

The QRCodeReader class takes a list of bytes and returns the decoded barcode.

import 'dart:io';
import 'package:image/image.dart' as img;
import 'package:zxing2/qrcode.dart';

void main() {
  var image = img.decodePng(File('tool/example.png').readAsBytesSync())!;

  LuminanceSource source = RGBLuminanceSource(
      image.width,
      image.height,
      image
          .convert(numChannels: 4)
          .getBytes(order: img.ChannelOrder.abgr)
          .buffer
          .asInt32List());
  var bitmap = BinaryBitmap(GlobalHistogramBinarizer(source));

  var reader = QRCodeReader();
  var result = reader.decode(bitmap);
  print(result.text);
}
Encoding

The QRCodeReader class takes a list of bytes and returns the decoded barcode.

import 'dart:io';
import 'package:image/image.dart' as img;
import 'package:zxing2/qrcode.dart';

void main() {
  var qrcode = Encoder.encode('ABCDEF', ErrorCorrectionLevel.h);
  var matrix = qrcode.matrix!;
  var scale = 4;

  var image = img.Image(
      width: matrix.width * scale,
      height: matrix.height * scale,
      numChannels: 4);
  for (var x = 0; x < matrix.width; x++) {
    for (var y = 0; y < matrix.height; y++) {
      if (matrix.get(x, y) == 1) {
        img.fillRect(image,
            x1: x * scale,
            y1: y * scale,
            x2: x * scale + scale,
            y2: y * scale + scale,
            color: img.ColorRgba8(0, 0, 0, 0xFF));
      }
    }
  }
  var pngBytes = img.encodePng(image);
  File('tool/examples/encoded.png').writeAsBytes(pngBytes);
}

Flutter

The example folder contains a full example that uses the official camera plugin connected to this package to decode barcode from the bytes stream.

カテゴリー

依存関係

依存関係一覧 4 件

ソースリポジトリ

このパッケージを使用しているプロジェクト