Search K
Are you an LLM? You can read better optimized documentation at /ja/tools/image/barcode-read.md for this page in Markdown format
Barcode Reader
アップロードされた画像であらゆる種類のバーコードと QR コードをスキャンします。検出された各コードについて、デコードされたテキスト、バーコードの種類、位置データを返します。また、検出されたコードの周囲に色付きのバウンディングボックスを描いた注釈付き画像も生成します。
API Endpoint
POST /api/v1/tools/image/barcode-read
画像ファイルとオプションの JSON settings フィールドを含むマルチパートフォームデータを受け付けます。
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| tryHarder | boolean | No | true | 読み取りが難しいバーコード向けにアグレッシブなスキャンモードを有効にします (低速ですがより徹底的) |
Example Request
bash
curl -X POST http://localhost:1349/api/v1/tools/image/barcode-read \
-H "Authorization: Bearer si_your-api-key" \
-F "[email protected]" \
-F 'settings={"tryHarder": true}'Example Response
json
{
"filename": "receipt.jpg",
"barcodes": [
{
"type": "QRCode",
"text": "https://example.com/product/123",
"position": {
"topLeft": { "x": 100, "y": 50 },
"topRight": { "x": 250, "y": 50 },
"bottomLeft": { "x": 100, "y": 200 },
"bottomRight": { "x": 250, "y": 200 }
}
},
{
"type": "EAN-13",
"text": "5901234123457",
"position": {
"topLeft": { "x": 50, "y": 400 },
"topRight": { "x": 300, "y": 400 },
"bottomLeft": { "x": 50, "y": 450 },
"bottomRight": { "x": 300, "y": 450 }
}
}
],
"annotatedUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/annotated-receipt.png",
"previewUrl": "/api/v1/download/a1b2c3d4-e5f6-7890-abcd-ef1234567890/annotated-receipt.png"
}Response Fields
| Field | Type | Description |
|---|---|---|
| filename | string | 元のファイル名 |
| barcodes | array | 検出されたバーコードオブジェクトの配列 |
| annotatedUrl | string or null | 注釈付き画像のダウンロード URL (バーコードが見つからない場合は null) |
| previewUrl | string or null | annotatedUrl と同じ (フロントエンドプレビュー互換性のため) |
Barcode Object
| Field | Type | Description |
|---|---|---|
| type | string | バーコード形式 (QRCode、EAN-13、Code128、DataMatrix、PDF417 など) |
| text | string | バーコードのデコードされたコンテンツ |
| position | object | topLeft、topRight、bottomLeft、bottomRight の座標を持つバウンディングボックス |
Supported Barcode Types
1D バーコード: Code128、Code39、Code93、Codabar、EAN-8、EAN-13、ITF、UPC-A、UPC-E
2D バーコード: QRCode、DataMatrix、PDF417、Aztec、MaxiCode
Notes
- バーコード検出には zxing-wasm ライブラリを使用します。
- 注釈付き画像は、検出された各バーコードに色付きのポリゴンバウンディングボックスと番号付きラベルを重ねて表示します。
- 1 枚の画像で最大 255 個のバーコードを検出できます。
- バーコードが見つからない場合、
barcodesは空の配列になり、annotatedUrlは null になります。 tryHarderモードは処理時間を犠牲にしてより徹底的なスキャンを実行します。クリーンでよく整列したバーコードを高速に処理するには無効にしてください。- 注釈付き出力は常に PNG 形式です。
- HEIC、RAW、PSD、SVG の入力はスキャン前に自動的にデコードされます。
- 処理前に EXIF の向きが自動的に適用されます。
