PNG JPG BMP TIFF SVG
Aspose.BarCode  for Python via Java
QR

Python via Java で QR バーコードを読み取ります

Python via Java API のサーバー側 Aspose.BarCode を使用して、Python で QR コード、GS1 QR コード を読み取ります

How to Read QR コード Using Python via Java

QR コード をスキャンしてデコードするには、 Aspose.BarCode for Python via Java API をインストールします。これは、多用途で強力で使いやすい API です。 Python ベースのアプリケーションにはバーコード ライブラリを使用します。 Aspose releases ポータルから最新バージョンを直接入手するか、次のコマンドを実行して pip から「aspose-barcode」をインストールします。

Command

  pip install aspose-barcode 

Python で QR コード をスキャンする手順

Aspose.BarCode を使用すると、開発者は数行のコードでストリームまたは画像から QR コード バーコードを読み取ることができます

  • Aspose.BarCode.BarCodeReader クラスのオブジェクトを作成します
  • パラメータとして QR コード を含むソース ファイル パスを定義します
  • 必要なバーコード タイプを決定します2 番目のパラメータとして DecodeType を指定します
  • デコード結果をループします
  • CodeText プロパティを使用してバーコード テキストを取得します

システム要求

Aspose API は、すべての主要なプラットフォームとオペレーティング システムでサポートされています。以下のコードサンプルを実行する前に、システムが次の要件を満たしていることを確認してください。

  • Microsoft Windows、Linux、または Python ベースの開発環境と互換性のある OS
  • Java 8 以降
  • Python 3.6 以降
  • PHP/Java Bridge がインストールされていること
  • FastCGI および Tomcat Server 8.0 以降
Ready to recognize 認識する ここにファイルをドロップするか、クリックして参照します *

* ファイルをアップロードするかサービスを使用すると、利用規約に同意したことになります。使用プライバシー ポリシー

Code to be executed - Python

    
import os
import base64
from asposebarcode import Recognition

class BarcodeReaderExamples():
    def readBarcodeImage(self):
        image_data_base64 = ta.load_image_base64_from_path("<file name>")
        reader = Recognition.BarcodeReader(image_data_base64, None, Recognition.DecodeType.QR)
        recognized_results = reader.readBarCodes()
        for x in recognized_results:
            print(x.getCodeText())
            print(x.getCodeTypeName())

    def load_image_base64_from_path(filePath):
        try:
            image_file = open(filePath, "rb")
            image_data_binary = image_file.read()
            return (base64.b64encode(image_data_binary)).decode('ascii')
        except Exception as ex:
            print('Failed to save image\\n ' + str(ex))
        
barcodeReaderExamples = BarcodeReaderExamples()
barcodeReaderExamples.readBarcodeImage()

認識結果

Other Supported Barcode Recognition Symbologies

Using Python via Java, One can also read barcode of different symbologies including the following.

2D:

Linear:

Postal: