拉取容器映像檔並讀取第一張 QR Code 圖片
QR Code 掃描器容器映像檔由 QR Code AI 發佈於 GitHub Container Registry(GHCR),並以經驗證發佈者身分收錄於 Artifact Hub。CLI 映像檔針對 Linux AMD64 與 ARM64 封裝了 qrscan:可離線讀取掛載的圖片檔案並輸出掃描報告。若您的服務偏好透過 HTTP 呼叫而非執行 CLI,GHCR 亦提供獨立的自架 HTTP 掃描服務映像檔。
拉取容器映像檔並讀取公開範例
第一道指令會將公開的 QR Code 範例圖片下載至目前目錄並命名為 clean-qr.png;接著的 docker 指令會拉取多平台 GHCR CLI 映像檔,並在無網路環境中掃描掛載的檔案。
curl -fsSL -o clean-qr.png \
https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/fixtures/clean/OK_68ms_100_4e875a2c.png
image=ghcr.io/qrcode-ai-com/qrcode-barcode-scanner:0.12.2
docker pull "$image"
docker run --rm --network none --read-only --cap-drop ALL \
--mount type=bind,src="$PWD",dst=/input,readonly "$image" /input/clean-qr.png --pretty此執行方式會以唯讀模式掛載目前目錄、移除所有系統權限(capabilities)並停用網路。--pretty 會以終端機摘要輸出第一筆偵測結果。qrscan 提供三種設定檔:預設的 full 以完整深度計算 QR 品質分數,fast 以較淺深度計算,而 frame 僅進行解碼。
本指南中的指令皆以 POSIX 殼層語法撰寫,例如 bash 或 zsh。
同一個容器映像檔也能讀取條碼:請參閱 條碼掃描器 Docker 指南。
輸出結果範例
容器映像檔內建相同的 qrscan 指令,因此輸出結果與 CLI 完全一致。針對該 範例圖片,--pretty 會印出以下終端機摘要:
content https://qrc-ai.com/76xMa
symbology QrCode
payload Url { url: "https://qrc-ai.com/76xMa" }
symbol v2 · 25x25 modules
engines rxing+rqrr
score 100/100 (Excellent)
resolution 5/5
blur 5/5
contrast 5/5
perspective 5/5
rotation 5/5
lighting 5/5
uec margin 1.00 (grade A · worst block 0/16 ec)
iso15415 overall A (informed, not certified)
contrast 1.00/A · modulation 1.00/A · axial 0.001/A · fixed-pattern 1.00/A
took 10ms最後一行的耗時會視您的主機效能而定。
在主機端儲存 JSON 報告
若要讀取您自己的圖片(此處以 qr-reference.png 為例),請將它放入掛載目錄中。不加 --pretty 時,qrscan 會將完整掃描報告以 JSON 輸出;請將輸出重導向至主機上的檔案,容器本身不會寫入任何資料。
docker run --rm --network none --read-only --cap-drop ALL \
--mount type=bind,src="$PWD",dst=/input,readonly \
ghcr.io/qrcode-ai-com/qrcode-barcode-scanner:0.12.2 /input/qr-reference.png --profile fast > report.json如果 qr-reference.png 中的 QR Code 編碼了 https://qrcode-ai.com/ ,掃描報告中就會包含該網址。
QR Code 掃描器 CLI 指南列出所有可用選項。
發佈指南 記錄了公開版本標籤、映像檔摘要值與來源驗證方式。
