napari-qrcode-barcode-scanner 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SuperNovae Studio — QR Code AI, by Thibaut Mélen & Nicolas Cella
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ prune tests
@@ -0,0 +1,272 @@
1
+ Metadata-Version: 2.4
2
+ Name: napari-qrcode-barcode-scanner
3
+ Version: 0.1.0
4
+ Summary: Read the QR codes and barcodes of a napari image layer with the QR Code & Barcode Scanner engine.
5
+ Author: Thibaut Mélen, Nicolas Cella
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://qrcode-ai.com/en-US/qr-code-scanner/integrations/napari
8
+ Project-URL: Documentation, https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/tree/main/integrations/napari
9
+ Project-URL: Source Code, https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust
10
+ Project-URL: Bug Tracker, https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/issues
11
+ Keywords: napari,qr-code,barcode,scanner,decoder
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Framework :: napari
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: numpy>=1.24
25
+ Requires-Dist: magicgui>=0.8
26
+ Requires-Dist: qrcode-barcode-scanner==0.11.0
27
+ Provides-Extra: all
28
+ Requires-Dist: napari[all]; extra == "all"
29
+ Dynamic: license-file
30
+
31
+ <p align="center">
32
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust">
33
+ <picture>
34
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/banner-napari-dark.gif?v=e2dd29dfa583">
35
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/banner-napari-light.gif?v=628f7e806945" alt="QR Code &amp; Barcode Scanner for napari: the napari logo, the Plugins menu command and its form, and a QR code and a barcode being read" width="100%">
36
+ </picture>
37
+ </a>
38
+ </p>
39
+
40
+ # QR Code & Barcode Scanner for napari
41
+
42
+ <!-- qrcode-ai-readme-actions:v2 -->
43
+
44
+ ### Ask AI
45
+
46
+ [![ChatGPT](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/chatgpt-v2.svg)](https://chatgpt.com/?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
47
+ [![Claude](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/claude-v2.svg)](https://claude.ai/new?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
48
+ [![Gemini](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/gemini-v2.svg)](https://gemini.google.com/)
49
+ [![Grok](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/grok-v2.svg)](https://grok.com/?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
50
+ [![Perplexity](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/perplexity-v2.svg)](https://www.perplexity.ai/?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
51
+ [![Copilot](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/copilot-v2.svg)](https://copilot.com/)
52
+ [![DeepSeek](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/deepseek-v2.svg)](https://chat.deepseek.com/)
53
+ [![Meta AI](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/meta-ai-v2.svg)](https://www.meta.ai/)
54
+ [![Qwen](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/qwen-v2.svg)](https://qwen.ai/)
55
+
56
+ Choose an AI assistant to explain this destination using its public sources. Gemini opens gemini.google.com. Gemini, Copilot, DeepSeek, Meta AI and Qwen require pasting the prompt below; the other links include it in their URL. Sign-in or a manual paste may still be required. Check the answer against the documentation.
57
+
58
+ <details>
59
+ <summary>Copy the plain-text prompt</summary>
60
+
61
+ Use the code block's copy control, or select its complete text, then paste it into your assistant.
62
+
63
+ ```text
64
+ Help me understand QR Code & Barcode Scanner for napari (integrations/napari/README.md) for QR Code & Barcode Scanner, the open-source scanner. Source documentation; publication is not implied. Provided README context (verify against the sources): A napari plugin that reads every QR code and barcode in an image layer. It outlines each code in a new shapes layer, labelled with its format and text, and keeps the engine's full report with it. The open-source engine runs inside napari's own Python: the image stays on your machine, and the layer's pixels are not changed. Read the public documentation below. Explain what this destination does, its documented installation or access steps, a minimal example if supported, prerequisites, limitations and license. Distinguish published packages from working source and preparation. Cite your sources; if a page is unavailable or a fact cannot be checked, say so. Do not invent installation commands, benchmark results or comparisons. Answer in my language. Public sources: https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/integrations/napari/README.md https://qrcode-ai.com/en-US/qr-code-scanner https://qrcode-ai.com/en-US/barcode-scanner https://qrcode-ai.com/en-US/qr-code-scanner/integrations/napari https://qrcode-ai.com/en-US/barcode-scanner/integrations/napari https://qrcode-ai.com/en-US/qr-code-generator https://qrcode-ai.com/en-US/barcode-generator
65
+ ```
66
+
67
+ </details>
68
+
69
+ <!-- /qrcode-ai-readme-actions:v2 -->
70
+
71
+ A napari plugin that reads every QR code and barcode in an image layer. It outlines each code in a new shapes layer, labelled with its format and text, and keeps the engine's full report with it. The open-source engine runs inside napari's own Python: the image stays on your machine, and the layer's pixels are not changed.
72
+
73
+ The [QR code scanner](https://qrcode-ai.com/en-US/qr-code-scanner) and the [barcode scanner](https://qrcode-ai.com/en-US/barcode-scanner) are QR Code AI's scanning pages in the browser. This plugin follows the same route as the [QR code scanner napari guide](https://qrcode-ai.com/en-US/qr-code-scanner/integrations/napari) and the [barcode scanner napari guide](https://qrcode-ai.com/en-US/barcode-scanner/integrations/napari). If a page is not online yet, this README is the reference.
74
+
75
+ To make a test image with a known value, use the [QR code generator](https://qrcode-ai.com/en-US/qr-code-generator) or the [barcode generator](https://qrcode-ai.com/en-US/barcode-generator). Open the exported image in napari, scan it and compare the label of the outline with the text you encoded.
76
+
77
+ ## Status
78
+
79
+ The plugin is on PyPI as
80
+ [`napari-qrcode-barcode-scanner`](https://pypi.org/project/napari-qrcode-barcode-scanner/) 0.1.0.
81
+ The engine repository published that version from its tag `napari-v0.1.0`, after the owner's
82
+ review, through PyPI trusted publishing: no token is stored. The files on PyPI are the sdist and
83
+ the wheel that the tag's run built, checked with `twine check --strict`, installed in a new
84
+ environment and tested on the sample in the three profiles. The plugin has also run in a napari
85
+ window, from its dock widget, as the picture below shows.
86
+
87
+ napari's plugin manager and the
88
+ [napari hub](https://napari-hub.org/plugins/napari-qrcode-barcode-scanner) read napari's plugin
89
+ index, which is rebuilt once a day, so they can list the plugin a day or so after its PyPI release.
90
+ What the listing shows, and where each value comes from, are in
91
+ [LISTING.md](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/integrations/napari/LISTING.md).
92
+
93
+ ## Install
94
+
95
+ Install the plugin from PyPI in the environment that runs napari:
96
+
97
+ ```sh
98
+ python -m pip install napari-qrcode-barcode-scanner
99
+ ```
100
+
101
+ Or, in napari, choose **Plugins**, **Install/Uninstall Plugins**, search for `qrcode`, install
102
+ **QR Code & Barcode Scanner** and restart napari.
103
+
104
+ Its dependencies are numpy, magicgui and the engine wheel
105
+ [`qrcode-barcode-scanner`](https://pypi.org/project/qrcode-barcode-scanner/0.11.0/) 0.11.0. As napari
106
+ plugins do, it does not install napari or Qt: use the napari you have, or install the plugin with
107
+ its `all` extra, `python -m pip install "napari-qrcode-barcode-scanner[all]"`, to get both.
108
+
109
+ To try a change to the plugin, install the folder from a checkout of this repository instead:
110
+ `python -m pip install ./integrations/napari`.
111
+
112
+ ## Use
113
+
114
+ Open an image, then choose **Plugins**, **Scan QR codes and barcodes (QR Code & Barcode Scanner)**.
115
+ Pick the image layer, a profile and a time budget, and press **Run**.
116
+
117
+ <p align="center">
118
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/integrations/napari/media/napari-window.png" alt="A napari window: the sample image with its QR code and its Code 128 barcode outlined and labelled in a new shapes layer, the layer list, and the plugin's form with the layer, profile and budget fields" width="100%">
119
+ </p>
120
+
121
+ - `profile`: `fast` (the default) suits uploads and gives a reduced quality score. `frame` gives
122
+ no score. `full` searches deepest and gives the full score; artistic QR codes from a generator
123
+ need it.
124
+ - `budget_ms`: a time limit in milliseconds. `0`, the default, means no limit.
125
+
126
+ The plugin adds a shapes layer named after the image, such as `sample codes`. A QR code or another
127
+ matrix code is outlined by its four corners. A barcode is drawn as the line the reader scanned
128
+ across it. Each shape is labelled with its format and text, and the full report is in the layer's
129
+ metadata, under `qrcode_barcode_scanner`. A notification sums up what was read. A new scan of the
130
+ same image replaces that layer; a scan that finds nothing removes it.
131
+
132
+ From a script, `scan_layer` returns the same result as napari layer data:
133
+
134
+ ```python
135
+ from napari_qrcode_barcode_scanner import scan_layer
136
+
137
+ data, meta, kind = scan_layer(viewer.layers["sample"], profile="full", budget_ms=0)
138
+ print([text for text in meta["features"]["text"]])
139
+ ```
140
+
141
+ ## Limits
142
+
143
+ - It reads 2D images: grey, RGB or RGBA. A stack or a volume is refused with a way out: split the
144
+ stack with **Layers**, **Split Stack**, or project it first. A multiscale image is read at its
145
+ full resolution.
146
+ - The pixels pass through the layer's contrast limits, as napari shows them. The layer's data is
147
+ only read.
148
+ - An image wider or taller than 10,000 pixels, or above 64 million pixels, is refused with the
149
+ engine's `QRS-` code.
150
+ - The scan runs while napari waits. A `full` scan of a large image can take seconds: set a budget
151
+ for those.
152
+
153
+ ## Develop
154
+
155
+ The tests call the widget function on napari's own layer classes and its viewer model, the model
156
+ behind the window:
157
+
158
+ ```sh
159
+ python -m venv .venv
160
+ .venv/bin/python -m pip install ./integrations/napari -r integrations/napari/tests/requirements.txt
161
+ .venv/bin/python -m pytest integrations/napari/tests
162
+ ```
163
+
164
+ They scan the sample in the three profiles, and grey, float, 16-bit, offset and RGBA layers. They
165
+ check that the pixels reach the engine unchanged, that the image layer is untouched, that a new
166
+ scan replaces the codes layer, and that stacks, bad options and refused sizes fail clearly. They
167
+ also check the manifest as napari discovers it and the form magicgui builds. The workflow
168
+ `integration-python-hosts` of the engine repository runs them on the built wheel, in a new
169
+ environment. The same workflow opens a napari window on a virtual display, with PyQt6, adds the
170
+ plugin's widget, runs a `full` scan of the sample and checks that both codes are outlined. It keeps
171
+ a picture of that window: `tests/capture_window.py` takes it, and `media/napari-window.png` is the
172
+ one above.
173
+
174
+ ## How it works
175
+
176
+ <p align="center">
177
+ <picture>
178
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/how-python-dark.gif?v=60b4945fed7e">
179
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/how-python-light.gif?v=bb48f1698ce2" alt="How the Python package works, in three steps: install the package, pass an image or a camera frame to the engine inside your process, and read the report" width="100%">
180
+ </picture>
181
+ </p>
182
+
183
+ The plugin reads the layer's 2D plane, maps it through its contrast limits to RGBA pixels and passes them to the engine, which runs in napari's Python process. Each scan gives one report.
184
+
185
+ ## What it returns
186
+
187
+ <p align="center">
188
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#examples">
189
+ <picture>
190
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/examples-mixed-dark.png?v=385593c1c18d">
191
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/examples-mixed-light.png?v=7f958679adcc" alt="A QR code and Code 128 decoded from the same image, each outlined where the engine measured it" width="100%">
192
+ </picture>
193
+ </a>
194
+ </p>
195
+
196
+ The picture is a recorded scan of the sample image, which holds a QR code and a Code 128 barcode.
197
+ Both come back in one report, each with its format, its exact text and the place where the engine
198
+ measured it: `https://qrc-ai.com/76xMa` and `STOCK-4827`.
199
+
200
+ The plugin returns a shapes layer: one shape per place the engine measured a code, with the code's `text` and `symbology` as features. The layer has the image's scale, translation, rotation, shear and affine transform, so the outlines sit on the codes.
201
+
202
+ The report itself is described field by field in the
203
+ [report reference](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/v0.11.0/docs/api/report.mdx).
204
+ An empty list of detections means the image holds no code the engine could read. A refused file
205
+ is an error with a `QRS-` code instead, listed in the
206
+ [error codes](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/v0.11.0/docs/api/errors.mdx).
207
+
208
+ ## What it reads
209
+
210
+ <p align="center">
211
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#supported-formats">
212
+ <picture>
213
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/formats-dark.gif?v=92fa0e8084df">
214
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/formats-light.gif?v=bdfe5fc5f9b3" alt="The code families the engine reads: QR codes, matrix and stacked codes such as Data Matrix, retail barcodes such as EAN-13, and other linear barcodes such as Code 128" width="100%">
215
+ </picture>
216
+ </a>
217
+ </p>
218
+
219
+ | Family | Formats |
220
+ |---|---|
221
+ | QR | QR Code, Micro QR, rectangular Micro QR (rMQR) |
222
+ | Matrix and stacked | Data Matrix, Aztec, PDF417, MaxiCode |
223
+ | Retail | EAN-13, EAN-8, UPC-A, UPC-E |
224
+ | Other linear | Code 128, Code 39, Code 93, Codabar, ITF, GS1 DataBar, GS1 DataBar Expanded, Telepen |
225
+
226
+ The plugin reads what the engine reads. Codes of different formats in one image come back in one report. The engine's
227
+ [supported formats](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#supported-formats)
228
+ section states the known limits.
229
+
230
+ ## The same engine in other runtimes
231
+
232
+ <p align="center">
233
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#get-started">
234
+ <picture>
235
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/runtimes-dark.png?v=57c63428574b">
236
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/runtimes-light.png?v=6dbd5a8cf5ba" alt="One engine in the language you write: Rust on crates.io, Node.js and the browser on npm, Python on PyPI, Go, PHP, and the qrscan command line" width="100%">
237
+ </picture>
238
+ </a>
239
+ </p>
240
+
241
+ | Runtime | Package | How it scans |
242
+ |---|---|---|
243
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-rust-dark.png?v=31b5deebc32e"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-rust-light.png?v=c5207721973f" alt="" width="24" height="24" align="absmiddle"></picture> Rust | [`qrcode-barcode-scanner`](https://crates.io/crates/qrcode-barcode-scanner) on crates.io | In process |
244
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-nodejs-dark.png?v=cf2159524fc6"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-nodejs-light.png?v=6dd098480218" alt="" width="24" height="24" align="absmiddle"></picture> Node.js | [`@qrcode-ai-com/qrcode-barcode-scanner`](https://www.npmjs.com/package/@qrcode-ai-com/qrcode-barcode-scanner) on npm | In process, native |
245
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-browser-dark.png?v=bbe2f3560a6d"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-browser-light.png?v=591e304cf9e9" alt="" width="24" height="24" align="absmiddle"></picture> Browser | [`@qrcode-ai-com/qrcode-barcode-scanner-wasm`](https://www.npmjs.com/package/@qrcode-ai-com/qrcode-barcode-scanner-wasm) on npm | In the page, WebAssembly |
246
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-python-dark.png?v=7469c3e0b4fb"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-python-light.png?v=308121255ab7" alt="" width="24" height="24" align="absmiddle"></picture> Python | [`qrcode-barcode-scanner`](https://pypi.org/project/qrcode-barcode-scanner/) on PyPI | In process |
247
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-go-dark.png?v=b6dbac901176"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-go-light.png?v=1983a9eb7344" alt="" width="24" height="24" align="absmiddle"></picture> Go | [`qrcode-barcode-scanner-go`](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-go) | Through the installed `qrscan` |
248
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-php-dark.png?v=3800932934c8"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-php-light.png?v=7bdd6884b3a4" alt="" width="24" height="24" align="absmiddle"></picture> PHP | [`qrcode-barcode-scanner-php`](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-php) | Through the installed `qrscan` |
249
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-terminal-dark.png?v=1e987f0ab278"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-terminal-light.png?v=2262d66bee6b" alt="" width="24" height="24" align="absmiddle"></picture> Command line | [`qrscan`](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#command-line) | One command, one JSON report |
250
+
251
+ The Rust, Node.js, browser and Python packages hold the engine. The Go and PHP packages hold no decoder:
252
+ each one starts `qrscan` and hands you its report.
253
+
254
+ <sub>Language and platform names and logos belong to their owners. They identify a runtime or a destination and imply no endorsement.</sub>
255
+
256
+ ## Licence
257
+
258
+ Project-authored plugin source is MIT; see [LICENSE](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/integrations/napari/LICENSE). The plugin installs the engine wheel `qrcode-barcode-scanner` 0.11.0 from PyPI and does not ship it. The published engine 0.11.0 keeps the license it shipped with, AGPL-3.0-or-later; read the license packaged with the version you install and the [licensing guide](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/LICENSING.md).
259
+
260
+ Maintained by **Thibaut Mélen & Nicolas Cella** for **QR Code AI**, a product of **SuperNovae Studio**. The license of each component is stated in its own license files.
261
+
262
+ <!-- qrscan-source-license:v1 -->
263
+
264
+ ## Source license
265
+
266
+ Project-authored scanner code and documentation in this checkout are available under the [MIT License](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/LICENSE). You may use, modify and redistribute this source in open-source or proprietary applications, including commercial products, while preserving the copyright and permission notice. Thibaut Mélen & Nicolas Cella develop QR Code AI at SuperNovae Studio.
267
+
268
+ Retained third-party code, dependencies, artwork and test data keep their own licenses and notices. The [licensing guide](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/LICENSING.md) explains these component boundaries; the project license does not assign a license to an unrelated platform or service.
269
+
270
+ Published archives retain the license shipped with their version. A pinned engine, adapter or bundle may therefore have different terms from this working source. Read its packaged license and the [license history](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/docs/guides/license-history.mdx) before reuse. The source change does not replace an archive or publish a new version.
271
+
272
+ <!-- /qrscan-source-license:v1 -->
@@ -0,0 +1,242 @@
1
+ <p align="center">
2
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/banner-napari-dark.gif?v=e2dd29dfa583">
5
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/banner-napari-light.gif?v=628f7e806945" alt="QR Code &amp; Barcode Scanner for napari: the napari logo, the Plugins menu command and its form, and a QR code and a barcode being read" width="100%">
6
+ </picture>
7
+ </a>
8
+ </p>
9
+
10
+ # QR Code & Barcode Scanner for napari
11
+
12
+ <!-- qrcode-ai-readme-actions:v2 -->
13
+
14
+ ### Ask AI
15
+
16
+ [![ChatGPT](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/chatgpt-v2.svg)](https://chatgpt.com/?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
17
+ [![Claude](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/claude-v2.svg)](https://claude.ai/new?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
18
+ [![Gemini](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/gemini-v2.svg)](https://gemini.google.com/)
19
+ [![Grok](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/grok-v2.svg)](https://grok.com/?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
20
+ [![Perplexity](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/perplexity-v2.svg)](https://www.perplexity.ai/?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
21
+ [![Copilot](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/copilot-v2.svg)](https://copilot.com/)
22
+ [![DeepSeek](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/deepseek-v2.svg)](https://chat.deepseek.com/)
23
+ [![Meta AI](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/meta-ai-v2.svg)](https://www.meta.ai/)
24
+ [![Qwen](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/qwen-v2.svg)](https://qwen.ai/)
25
+
26
+ Choose an AI assistant to explain this destination using its public sources. Gemini opens gemini.google.com. Gemini, Copilot, DeepSeek, Meta AI and Qwen require pasting the prompt below; the other links include it in their URL. Sign-in or a manual paste may still be required. Check the answer against the documentation.
27
+
28
+ <details>
29
+ <summary>Copy the plain-text prompt</summary>
30
+
31
+ Use the code block's copy control, or select its complete text, then paste it into your assistant.
32
+
33
+ ```text
34
+ Help me understand QR Code & Barcode Scanner for napari (integrations/napari/README.md) for QR Code & Barcode Scanner, the open-source scanner. Source documentation; publication is not implied. Provided README context (verify against the sources): A napari plugin that reads every QR code and barcode in an image layer. It outlines each code in a new shapes layer, labelled with its format and text, and keeps the engine's full report with it. The open-source engine runs inside napari's own Python: the image stays on your machine, and the layer's pixels are not changed. Read the public documentation below. Explain what this destination does, its documented installation or access steps, a minimal example if supported, prerequisites, limitations and license. Distinguish published packages from working source and preparation. Cite your sources; if a page is unavailable or a fact cannot be checked, say so. Do not invent installation commands, benchmark results or comparisons. Answer in my language. Public sources: https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/integrations/napari/README.md https://qrcode-ai.com/en-US/qr-code-scanner https://qrcode-ai.com/en-US/barcode-scanner https://qrcode-ai.com/en-US/qr-code-scanner/integrations/napari https://qrcode-ai.com/en-US/barcode-scanner/integrations/napari https://qrcode-ai.com/en-US/qr-code-generator https://qrcode-ai.com/en-US/barcode-generator
35
+ ```
36
+
37
+ </details>
38
+
39
+ <!-- /qrcode-ai-readme-actions:v2 -->
40
+
41
+ A napari plugin that reads every QR code and barcode in an image layer. It outlines each code in a new shapes layer, labelled with its format and text, and keeps the engine's full report with it. The open-source engine runs inside napari's own Python: the image stays on your machine, and the layer's pixels are not changed.
42
+
43
+ The [QR code scanner](https://qrcode-ai.com/en-US/qr-code-scanner) and the [barcode scanner](https://qrcode-ai.com/en-US/barcode-scanner) are QR Code AI's scanning pages in the browser. This plugin follows the same route as the [QR code scanner napari guide](https://qrcode-ai.com/en-US/qr-code-scanner/integrations/napari) and the [barcode scanner napari guide](https://qrcode-ai.com/en-US/barcode-scanner/integrations/napari). If a page is not online yet, this README is the reference.
44
+
45
+ To make a test image with a known value, use the [QR code generator](https://qrcode-ai.com/en-US/qr-code-generator) or the [barcode generator](https://qrcode-ai.com/en-US/barcode-generator). Open the exported image in napari, scan it and compare the label of the outline with the text you encoded.
46
+
47
+ ## Status
48
+
49
+ The plugin is on PyPI as
50
+ [`napari-qrcode-barcode-scanner`](https://pypi.org/project/napari-qrcode-barcode-scanner/) 0.1.0.
51
+ The engine repository published that version from its tag `napari-v0.1.0`, after the owner's
52
+ review, through PyPI trusted publishing: no token is stored. The files on PyPI are the sdist and
53
+ the wheel that the tag's run built, checked with `twine check --strict`, installed in a new
54
+ environment and tested on the sample in the three profiles. The plugin has also run in a napari
55
+ window, from its dock widget, as the picture below shows.
56
+
57
+ napari's plugin manager and the
58
+ [napari hub](https://napari-hub.org/plugins/napari-qrcode-barcode-scanner) read napari's plugin
59
+ index, which is rebuilt once a day, so they can list the plugin a day or so after its PyPI release.
60
+ What the listing shows, and where each value comes from, are in
61
+ [LISTING.md](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/integrations/napari/LISTING.md).
62
+
63
+ ## Install
64
+
65
+ Install the plugin from PyPI in the environment that runs napari:
66
+
67
+ ```sh
68
+ python -m pip install napari-qrcode-barcode-scanner
69
+ ```
70
+
71
+ Or, in napari, choose **Plugins**, **Install/Uninstall Plugins**, search for `qrcode`, install
72
+ **QR Code & Barcode Scanner** and restart napari.
73
+
74
+ Its dependencies are numpy, magicgui and the engine wheel
75
+ [`qrcode-barcode-scanner`](https://pypi.org/project/qrcode-barcode-scanner/0.11.0/) 0.11.0. As napari
76
+ plugins do, it does not install napari or Qt: use the napari you have, or install the plugin with
77
+ its `all` extra, `python -m pip install "napari-qrcode-barcode-scanner[all]"`, to get both.
78
+
79
+ To try a change to the plugin, install the folder from a checkout of this repository instead:
80
+ `python -m pip install ./integrations/napari`.
81
+
82
+ ## Use
83
+
84
+ Open an image, then choose **Plugins**, **Scan QR codes and barcodes (QR Code & Barcode Scanner)**.
85
+ Pick the image layer, a profile and a time budget, and press **Run**.
86
+
87
+ <p align="center">
88
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/integrations/napari/media/napari-window.png" alt="A napari window: the sample image with its QR code and its Code 128 barcode outlined and labelled in a new shapes layer, the layer list, and the plugin's form with the layer, profile and budget fields" width="100%">
89
+ </p>
90
+
91
+ - `profile`: `fast` (the default) suits uploads and gives a reduced quality score. `frame` gives
92
+ no score. `full` searches deepest and gives the full score; artistic QR codes from a generator
93
+ need it.
94
+ - `budget_ms`: a time limit in milliseconds. `0`, the default, means no limit.
95
+
96
+ The plugin adds a shapes layer named after the image, such as `sample codes`. A QR code or another
97
+ matrix code is outlined by its four corners. A barcode is drawn as the line the reader scanned
98
+ across it. Each shape is labelled with its format and text, and the full report is in the layer's
99
+ metadata, under `qrcode_barcode_scanner`. A notification sums up what was read. A new scan of the
100
+ same image replaces that layer; a scan that finds nothing removes it.
101
+
102
+ From a script, `scan_layer` returns the same result as napari layer data:
103
+
104
+ ```python
105
+ from napari_qrcode_barcode_scanner import scan_layer
106
+
107
+ data, meta, kind = scan_layer(viewer.layers["sample"], profile="full", budget_ms=0)
108
+ print([text for text in meta["features"]["text"]])
109
+ ```
110
+
111
+ ## Limits
112
+
113
+ - It reads 2D images: grey, RGB or RGBA. A stack or a volume is refused with a way out: split the
114
+ stack with **Layers**, **Split Stack**, or project it first. A multiscale image is read at its
115
+ full resolution.
116
+ - The pixels pass through the layer's contrast limits, as napari shows them. The layer's data is
117
+ only read.
118
+ - An image wider or taller than 10,000 pixels, or above 64 million pixels, is refused with the
119
+ engine's `QRS-` code.
120
+ - The scan runs while napari waits. A `full` scan of a large image can take seconds: set a budget
121
+ for those.
122
+
123
+ ## Develop
124
+
125
+ The tests call the widget function on napari's own layer classes and its viewer model, the model
126
+ behind the window:
127
+
128
+ ```sh
129
+ python -m venv .venv
130
+ .venv/bin/python -m pip install ./integrations/napari -r integrations/napari/tests/requirements.txt
131
+ .venv/bin/python -m pytest integrations/napari/tests
132
+ ```
133
+
134
+ They scan the sample in the three profiles, and grey, float, 16-bit, offset and RGBA layers. They
135
+ check that the pixels reach the engine unchanged, that the image layer is untouched, that a new
136
+ scan replaces the codes layer, and that stacks, bad options and refused sizes fail clearly. They
137
+ also check the manifest as napari discovers it and the form magicgui builds. The workflow
138
+ `integration-python-hosts` of the engine repository runs them on the built wheel, in a new
139
+ environment. The same workflow opens a napari window on a virtual display, with PyQt6, adds the
140
+ plugin's widget, runs a `full` scan of the sample and checks that both codes are outlined. It keeps
141
+ a picture of that window: `tests/capture_window.py` takes it, and `media/napari-window.png` is the
142
+ one above.
143
+
144
+ ## How it works
145
+
146
+ <p align="center">
147
+ <picture>
148
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/how-python-dark.gif?v=60b4945fed7e">
149
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/how-python-light.gif?v=bb48f1698ce2" alt="How the Python package works, in three steps: install the package, pass an image or a camera frame to the engine inside your process, and read the report" width="100%">
150
+ </picture>
151
+ </p>
152
+
153
+ The plugin reads the layer's 2D plane, maps it through its contrast limits to RGBA pixels and passes them to the engine, which runs in napari's Python process. Each scan gives one report.
154
+
155
+ ## What it returns
156
+
157
+ <p align="center">
158
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#examples">
159
+ <picture>
160
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/examples-mixed-dark.png?v=385593c1c18d">
161
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/examples-mixed-light.png?v=7f958679adcc" alt="A QR code and Code 128 decoded from the same image, each outlined where the engine measured it" width="100%">
162
+ </picture>
163
+ </a>
164
+ </p>
165
+
166
+ The picture is a recorded scan of the sample image, which holds a QR code and a Code 128 barcode.
167
+ Both come back in one report, each with its format, its exact text and the place where the engine
168
+ measured it: `https://qrc-ai.com/76xMa` and `STOCK-4827`.
169
+
170
+ The plugin returns a shapes layer: one shape per place the engine measured a code, with the code's `text` and `symbology` as features. The layer has the image's scale, translation, rotation, shear and affine transform, so the outlines sit on the codes.
171
+
172
+ The report itself is described field by field in the
173
+ [report reference](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/v0.11.0/docs/api/report.mdx).
174
+ An empty list of detections means the image holds no code the engine could read. A refused file
175
+ is an error with a `QRS-` code instead, listed in the
176
+ [error codes](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/v0.11.0/docs/api/errors.mdx).
177
+
178
+ ## What it reads
179
+
180
+ <p align="center">
181
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#supported-formats">
182
+ <picture>
183
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/formats-dark.gif?v=92fa0e8084df">
184
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/formats-light.gif?v=bdfe5fc5f9b3" alt="The code families the engine reads: QR codes, matrix and stacked codes such as Data Matrix, retail barcodes such as EAN-13, and other linear barcodes such as Code 128" width="100%">
185
+ </picture>
186
+ </a>
187
+ </p>
188
+
189
+ | Family | Formats |
190
+ |---|---|
191
+ | QR | QR Code, Micro QR, rectangular Micro QR (rMQR) |
192
+ | Matrix and stacked | Data Matrix, Aztec, PDF417, MaxiCode |
193
+ | Retail | EAN-13, EAN-8, UPC-A, UPC-E |
194
+ | Other linear | Code 128, Code 39, Code 93, Codabar, ITF, GS1 DataBar, GS1 DataBar Expanded, Telepen |
195
+
196
+ The plugin reads what the engine reads. Codes of different formats in one image come back in one report. The engine's
197
+ [supported formats](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#supported-formats)
198
+ section states the known limits.
199
+
200
+ ## The same engine in other runtimes
201
+
202
+ <p align="center">
203
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#get-started">
204
+ <picture>
205
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/runtimes-dark.png?v=57c63428574b">
206
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/runtimes-light.png?v=6dbd5a8cf5ba" alt="One engine in the language you write: Rust on crates.io, Node.js and the browser on npm, Python on PyPI, Go, PHP, and the qrscan command line" width="100%">
207
+ </picture>
208
+ </a>
209
+ </p>
210
+
211
+ | Runtime | Package | How it scans |
212
+ |---|---|---|
213
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-rust-dark.png?v=31b5deebc32e"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-rust-light.png?v=c5207721973f" alt="" width="24" height="24" align="absmiddle"></picture> Rust | [`qrcode-barcode-scanner`](https://crates.io/crates/qrcode-barcode-scanner) on crates.io | In process |
214
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-nodejs-dark.png?v=cf2159524fc6"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-nodejs-light.png?v=6dd098480218" alt="" width="24" height="24" align="absmiddle"></picture> Node.js | [`@qrcode-ai-com/qrcode-barcode-scanner`](https://www.npmjs.com/package/@qrcode-ai-com/qrcode-barcode-scanner) on npm | In process, native |
215
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-browser-dark.png?v=bbe2f3560a6d"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-browser-light.png?v=591e304cf9e9" alt="" width="24" height="24" align="absmiddle"></picture> Browser | [`@qrcode-ai-com/qrcode-barcode-scanner-wasm`](https://www.npmjs.com/package/@qrcode-ai-com/qrcode-barcode-scanner-wasm) on npm | In the page, WebAssembly |
216
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-python-dark.png?v=7469c3e0b4fb"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-python-light.png?v=308121255ab7" alt="" width="24" height="24" align="absmiddle"></picture> Python | [`qrcode-barcode-scanner`](https://pypi.org/project/qrcode-barcode-scanner/) on PyPI | In process |
217
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-go-dark.png?v=b6dbac901176"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-go-light.png?v=1983a9eb7344" alt="" width="24" height="24" align="absmiddle"></picture> Go | [`qrcode-barcode-scanner-go`](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-go) | Through the installed `qrscan` |
218
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-php-dark.png?v=3800932934c8"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-php-light.png?v=7bdd6884b3a4" alt="" width="24" height="24" align="absmiddle"></picture> PHP | [`qrcode-barcode-scanner-php`](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-php) | Through the installed `qrscan` |
219
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-terminal-dark.png?v=1e987f0ab278"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-terminal-light.png?v=2262d66bee6b" alt="" width="24" height="24" align="absmiddle"></picture> Command line | [`qrscan`](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#command-line) | One command, one JSON report |
220
+
221
+ The Rust, Node.js, browser and Python packages hold the engine. The Go and PHP packages hold no decoder:
222
+ each one starts `qrscan` and hands you its report.
223
+
224
+ <sub>Language and platform names and logos belong to their owners. They identify a runtime or a destination and imply no endorsement.</sub>
225
+
226
+ ## Licence
227
+
228
+ Project-authored plugin source is MIT; see [LICENSE](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/integrations/napari/LICENSE). The plugin installs the engine wheel `qrcode-barcode-scanner` 0.11.0 from PyPI and does not ship it. The published engine 0.11.0 keeps the license it shipped with, AGPL-3.0-or-later; read the license packaged with the version you install and the [licensing guide](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/LICENSING.md).
229
+
230
+ Maintained by **Thibaut Mélen & Nicolas Cella** for **QR Code AI**, a product of **SuperNovae Studio**. The license of each component is stated in its own license files.
231
+
232
+ <!-- qrscan-source-license:v1 -->
233
+
234
+ ## Source license
235
+
236
+ Project-authored scanner code and documentation in this checkout are available under the [MIT License](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/LICENSE). You may use, modify and redistribute this source in open-source or proprietary applications, including commercial products, while preserving the copyright and permission notice. Thibaut Mélen & Nicolas Cella develop QR Code AI at SuperNovae Studio.
237
+
238
+ Retained third-party code, dependencies, artwork and test data keep their own licenses and notices. The [licensing guide](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/LICENSING.md) explains these component boundaries; the project license does not assign a license to an unrelated platform or service.
239
+
240
+ Published archives retain the license shipped with their version. A pinned engine, adapter or bundle may therefore have different terms from this working source. Read its packaged license and the [license history](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/docs/guides/license-history.mdx) before reuse. The source change does not replace an archive or publish a new version.
241
+
242
+ <!-- /qrscan-source-license:v1 -->
@@ -0,0 +1,50 @@
1
+ [build-system]
2
+ requires = ["setuptools>=80", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "napari-qrcode-barcode-scanner"
7
+ version = "0.1.0"
8
+ description = "Read the QR codes and barcodes of a napari image layer with the QR Code & Barcode Scanner engine."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ authors = [{ name = "Thibaut Mélen" }, { name = "Nicolas Cella" }]
13
+ requires-python = ">=3.11"
14
+ # The napari plugin convention: napari and a Qt backend are the user's, not dependencies.
15
+ dependencies = [
16
+ "numpy>=1.24",
17
+ "magicgui>=0.8",
18
+ "qrcode-barcode-scanner==0.11.0",
19
+ ]
20
+ keywords = ["napari", "qr-code", "barcode", "scanner", "decoder"]
21
+ classifiers = [
22
+ "Development Status :: 4 - Beta",
23
+ "Framework :: napari",
24
+ "Intended Audience :: Science/Research",
25
+ "Operating System :: MacOS",
26
+ "Operating System :: Microsoft :: Windows",
27
+ "Operating System :: POSIX :: Linux",
28
+ "Programming Language :: Python :: 3",
29
+ "Programming Language :: Python :: 3 :: Only",
30
+ "Topic :: Scientific/Engineering :: Image Processing",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ all = ["napari[all]"]
35
+
36
+ # The napari hub draws its GitHub link from "Source Code" (a repository root) and shows the others.
37
+ [project.urls]
38
+ Homepage = "https://qrcode-ai.com/en-US/qr-code-scanner/integrations/napari"
39
+ Documentation = "https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/tree/main/integrations/napari"
40
+ "Source Code" = "https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust"
41
+ "Bug Tracker" = "https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/issues"
42
+
43
+ [project.entry-points."napari.manifest"]
44
+ napari-qrcode-barcode-scanner = "napari_qrcode_barcode_scanner:napari.yaml"
45
+
46
+ [tool.setuptools.packages.find]
47
+ where = ["src"]
48
+
49
+ [tool.setuptools.package-data]
50
+ napari_qrcode_barcode_scanner = ["napari.yaml"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ """napari plugin: read QR codes and barcodes in an image layer with the QR Code & Barcode Scanner engine."""
2
+ from ._widget import scan_codes, scan_layer
3
+
4
+ __version__ = "0.1.0"
5
+ __all__ = ["scan_codes", "scan_layer"]
@@ -0,0 +1,127 @@
1
+ """Scan the selected image layer and outline each QR code and barcode it reads in a Shapes layer.
2
+
3
+ The pixels are the layer's own, mapped through its contrast limits as napari shows them, and are
4
+ read by the published engine wheel inside napari's process. Nothing is sent anywhere.
5
+ """
6
+ from typing import Annotated, Literal
7
+
8
+ import numpy as np
9
+ import qrcode_barcode_scanner as scanner
10
+
11
+ PROFILES = ("fast", "frame", "full")
12
+ MAX_BUDGET_MS = 600_000
13
+ EDGE_COLOR = "#22d3ee"
14
+ # What a reader measured, drawn as napari draws it. "unavailable" has no point to draw.
15
+ SHAPE_TYPES = {"quad": "polygon", "segment": "line", "partial": "path"}
16
+ MIN_POINTS = {"polygon": 3, "line": 2, "path": 2}
17
+
18
+
19
+ def to_rgba(image) -> tuple[bytes, int, int]:
20
+ """The plane of a 2D image layer as RGBA bytes, through the layer's contrast limits."""
21
+ if image.ndim != 2:
22
+ raise ValueError(
23
+ f"The layer {image.name!r} has {image.ndim} dimensions. Scan a 2D image: "
24
+ "split a stack with Layers > Split Stack, or project it first.")
25
+ data = np.asarray(image.data[0] if image.multiscale else image.data)
26
+ if image.rgb:
27
+ channels = data.shape[-1]
28
+ else:
29
+ data, channels = data[..., None], 1
30
+ low, high = (float(limit) for limit in image.contrast_limits)
31
+ if data.dtype == np.uint8 and (low, high) == (0.0, 255.0):
32
+ pixels = data
33
+ else:
34
+ scaled = (np.nan_to_num(data.astype(np.float64)) - low) / max(high - low, np.finfo(float).eps)
35
+ pixels = np.rint(np.clip(scaled, 0.0, 1.0) * 255).astype(np.uint8)
36
+ if channels == 1:
37
+ pixels = np.repeat(pixels, 3, axis=-1)
38
+ if pixels.shape[-1] == 3:
39
+ alpha = np.full(pixels.shape[:-1] + (1,), 255, dtype=np.uint8)
40
+ pixels = np.concatenate([pixels, alpha], axis=-1)
41
+ height, width = pixels.shape[:2]
42
+ return np.ascontiguousarray(pixels).tobytes(), width, height
43
+
44
+
45
+ def summary(name: str, report: dict) -> str:
46
+ """One line for napari's notification: what was read in which layer."""
47
+ found = [f"{row['symbology']}: {row['content']['text']}" for row in report["detections"]]
48
+ line = (f"{name}: {len(found)} code(s) found. " + "; ".join(found)) if found else f"{name}: no QR code or barcode found."
49
+ if report["trace"]["budget_exhausted"]:
50
+ line += " The time budget cut the scan, so this result is not final."
51
+ return line
52
+
53
+
54
+ def shapes(report: dict) -> tuple[list[np.ndarray], list[str], dict[str, list[str]]]:
55
+ """Each measured occurrence as a napari shape in (row, column) order, with its code's text."""
56
+ data, types, features = [], [], {"text": [], "symbology": []}
57
+ for row in report["detections"]:
58
+ for occurrence in row.get("occurrences") or []:
59
+ geometry = occurrence["geometry"]
60
+ kind = SHAPE_TYPES.get(geometry["kind"])
61
+ points = geometry.get("points") or []
62
+ if kind is None or len(points) < MIN_POINTS[kind]:
63
+ continue
64
+ data.append(np.array([[point["y"], point["x"]] for point in points], dtype=float))
65
+ types.append(kind)
66
+ features["text"].append(row["content"]["text"])
67
+ features["symbology"].append(row["symbology"])
68
+ return data, types, features
69
+
70
+
71
+ def notify(message: str) -> None:
72
+ from napari.utils.notifications import show_info
73
+
74
+ show_info(message)
75
+
76
+
77
+ def scan_layer(image, profile: str = "fast", budget_ms: int = 0):
78
+ """The codes of a 2D image layer as a napari layer data tuple (data, metadata, "shapes")."""
79
+ if image is None:
80
+ raise ValueError("Open or select an image layer to scan.")
81
+ if profile not in PROFILES:
82
+ raise ValueError(f"Unknown profile {profile!r}: use fast, frame or full.")
83
+ if isinstance(budget_ms, bool) or not 0 <= int(budget_ms) <= MAX_BUDGET_MS:
84
+ raise ValueError(f"budget_ms must be from 0 to {MAX_BUDGET_MS}.")
85
+ rgba, width, height = to_rgba(image)
86
+ report = scanner.scan_frame(rgba, width, height, profile=profile, budget_ms=int(budget_ms))
87
+ data, types, features = shapes(report)
88
+ meta = {
89
+ "name": f"{image.name} codes",
90
+ "shape_type": types,
91
+ "features": features,
92
+ "text": {"string": "{symbology}: {text}", "color": EDGE_COLOR, "size": 12, "anchor": "upper_left"},
93
+ "edge_color": EDGE_COLOR,
94
+ "face_color": "transparent",
95
+ "edge_width": max(2.0, round(min(width, height) / 250, 1)),
96
+ # The outlines sit on the image whatever its transform.
97
+ "scale": image.scale,
98
+ "translate": image.translate,
99
+ "rotate": image.rotate,
100
+ "shear": image.shear,
101
+ "affine": image.affine.affine_matrix,
102
+ "metadata": {"qrcode_barcode_scanner": report},
103
+ }
104
+ return data, meta, "shapes"
105
+
106
+
107
+ def scan_codes(
108
+ image: "napari.layers.Image", # noqa: F821 - resolved by magicgui inside napari
109
+ profile: Literal["fast", "frame", "full"] = "fast",
110
+ budget_ms: Annotated[int, {"min": 0, "max": MAX_BUDGET_MS, "step": 10,
111
+ "tooltip": "Stop after this many milliseconds. 0 means no budget."}] = 0,
112
+ viewer: "napari.viewer.Viewer" = None, # noqa: F821 - napari passes its viewer, the form hides it
113
+ ) -> None:
114
+ """Read every QR code and barcode in the image layer and outline them in a "<layer> codes" layer.
115
+
116
+ A new scan replaces the codes layer of the same image. With no code found, it is removed.
117
+ """
118
+ from napari.layers import Layer
119
+
120
+ data, meta, kind = scan_layer(image, profile, budget_ms)
121
+ notify(summary(image.name, meta["metadata"]["qrcode_barcode_scanner"]))
122
+ if viewer is None:
123
+ return
124
+ if meta["name"] in viewer.layers:
125
+ viewer.layers.remove(viewer.layers[meta["name"]])
126
+ if data:
127
+ viewer.add_layer(Layer.create(data, meta, kind))
@@ -0,0 +1,13 @@
1
+ name: napari-qrcode-barcode-scanner
2
+ display_name: QR Code & Barcode Scanner
3
+ visibility: public
4
+ categories: ["Measurement", "Utilities"]
5
+ contributions:
6
+ commands:
7
+ - id: napari-qrcode-barcode-scanner.scan_codes
8
+ python_name: napari_qrcode_barcode_scanner._widget:scan_codes
9
+ title: Scan QR codes and barcodes
10
+ widgets:
11
+ - command: napari-qrcode-barcode-scanner.scan_codes
12
+ display_name: Scan QR codes and barcodes
13
+ autogenerate: true
@@ -0,0 +1,272 @@
1
+ Metadata-Version: 2.4
2
+ Name: napari-qrcode-barcode-scanner
3
+ Version: 0.1.0
4
+ Summary: Read the QR codes and barcodes of a napari image layer with the QR Code & Barcode Scanner engine.
5
+ Author: Thibaut Mélen, Nicolas Cella
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://qrcode-ai.com/en-US/qr-code-scanner/integrations/napari
8
+ Project-URL: Documentation, https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/tree/main/integrations/napari
9
+ Project-URL: Source Code, https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust
10
+ Project-URL: Bug Tracker, https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/issues
11
+ Keywords: napari,qr-code,barcode,scanner,decoder
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Framework :: napari
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3 :: Only
20
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: numpy>=1.24
25
+ Requires-Dist: magicgui>=0.8
26
+ Requires-Dist: qrcode-barcode-scanner==0.11.0
27
+ Provides-Extra: all
28
+ Requires-Dist: napari[all]; extra == "all"
29
+ Dynamic: license-file
30
+
31
+ <p align="center">
32
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust">
33
+ <picture>
34
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/banner-napari-dark.gif?v=e2dd29dfa583">
35
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/banner-napari-light.gif?v=628f7e806945" alt="QR Code &amp; Barcode Scanner for napari: the napari logo, the Plugins menu command and its form, and a QR code and a barcode being read" width="100%">
36
+ </picture>
37
+ </a>
38
+ </p>
39
+
40
+ # QR Code & Barcode Scanner for napari
41
+
42
+ <!-- qrcode-ai-readme-actions:v2 -->
43
+
44
+ ### Ask AI
45
+
46
+ [![ChatGPT](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/chatgpt-v2.svg)](https://chatgpt.com/?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
47
+ [![Claude](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/claude-v2.svg)](https://claude.ai/new?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
48
+ [![Gemini](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/gemini-v2.svg)](https://gemini.google.com/)
49
+ [![Grok](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/grok-v2.svg)](https://grok.com/?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
50
+ [![Perplexity](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/perplexity-v2.svg)](https://www.perplexity.ai/?q=Help%20me%20understand%20QR%20Code%20%26%20Barcode%20Scanner%20for%20napari%20%28integrations%2Fnapari%2FREADME.md%29%20for%20QR%20Code%20%26%20Barcode%20Scanner%2C%20the%20open-source%20scanner.%20Source%20documentation%3B%20publication%20is%20not%20implied.%20Provided%20README%20context%20%28verify%20against%20the%20sources%29%3A%20A%20napari%20plugin%20that%20reads%20every%20QR%20code%20and%20barcode%20in%20an%20image%20layer.%20It%20outlines%20each%20code%20in%20a%20new%20shapes%20layer%2C%20labelled%20with%20its%20format%20and%20text%2C%20and%20keeps%20the%20engine%27s%20full%20report%20with%20it.%20The%20open-source%20engine%20runs%20inside%20napari%27s%20own%20Python%3A%20the%20image%20stays%20on%20your%20machine%2C%20and%20the%20layer%27s%20pixels%20are%20not%20changed.%20Read%20the%20public%20documentation%20below.%20Explain%20what%20this%20destination%20does%2C%20its%20documented%20installation%20or%20access%20steps%2C%20a%20minimal%20example%20if%20supported%2C%20prerequisites%2C%20limitations%20and%20license.%20Distinguish%20published%20packages%20from%20working%20source%20and%20preparation.%20Cite%20your%20sources%3B%20if%20a%20page%20is%20unavailable%20or%20a%20fact%20cannot%20be%20checked%2C%20say%20so.%20Do%20not%20invent%20installation%20commands%2C%20benchmark%20results%20or%20comparisons.%20Answer%20in%20my%20language.%20Public%20sources%3A%20https%3A%2F%2Fgithub.com%2Fqrcode-ai-com%2Fqrcode-barcode-scanner-rust%2Fblob%2Fmain%2Fintegrations%2Fnapari%2FREADME.md%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-scanner%2Fintegrations%2Fnapari%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fqr-code-generator%20https%3A%2F%2Fqrcode-ai.com%2Fen-US%2Fbarcode-generator)
51
+ [![Copilot](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/copilot-v2.svg)](https://copilot.com/)
52
+ [![DeepSeek](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/deepseek-v2.svg)](https://chat.deepseek.com/)
53
+ [![Meta AI](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/meta-ai-v2.svg)](https://www.meta.ai/)
54
+ [![Qwen](https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/actions/qwen-v2.svg)](https://qwen.ai/)
55
+
56
+ Choose an AI assistant to explain this destination using its public sources. Gemini opens gemini.google.com. Gemini, Copilot, DeepSeek, Meta AI and Qwen require pasting the prompt below; the other links include it in their URL. Sign-in or a manual paste may still be required. Check the answer against the documentation.
57
+
58
+ <details>
59
+ <summary>Copy the plain-text prompt</summary>
60
+
61
+ Use the code block's copy control, or select its complete text, then paste it into your assistant.
62
+
63
+ ```text
64
+ Help me understand QR Code & Barcode Scanner for napari (integrations/napari/README.md) for QR Code & Barcode Scanner, the open-source scanner. Source documentation; publication is not implied. Provided README context (verify against the sources): A napari plugin that reads every QR code and barcode in an image layer. It outlines each code in a new shapes layer, labelled with its format and text, and keeps the engine's full report with it. The open-source engine runs inside napari's own Python: the image stays on your machine, and the layer's pixels are not changed. Read the public documentation below. Explain what this destination does, its documented installation or access steps, a minimal example if supported, prerequisites, limitations and license. Distinguish published packages from working source and preparation. Cite your sources; if a page is unavailable or a fact cannot be checked, say so. Do not invent installation commands, benchmark results or comparisons. Answer in my language. Public sources: https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/integrations/napari/README.md https://qrcode-ai.com/en-US/qr-code-scanner https://qrcode-ai.com/en-US/barcode-scanner https://qrcode-ai.com/en-US/qr-code-scanner/integrations/napari https://qrcode-ai.com/en-US/barcode-scanner/integrations/napari https://qrcode-ai.com/en-US/qr-code-generator https://qrcode-ai.com/en-US/barcode-generator
65
+ ```
66
+
67
+ </details>
68
+
69
+ <!-- /qrcode-ai-readme-actions:v2 -->
70
+
71
+ A napari plugin that reads every QR code and barcode in an image layer. It outlines each code in a new shapes layer, labelled with its format and text, and keeps the engine's full report with it. The open-source engine runs inside napari's own Python: the image stays on your machine, and the layer's pixels are not changed.
72
+
73
+ The [QR code scanner](https://qrcode-ai.com/en-US/qr-code-scanner) and the [barcode scanner](https://qrcode-ai.com/en-US/barcode-scanner) are QR Code AI's scanning pages in the browser. This plugin follows the same route as the [QR code scanner napari guide](https://qrcode-ai.com/en-US/qr-code-scanner/integrations/napari) and the [barcode scanner napari guide](https://qrcode-ai.com/en-US/barcode-scanner/integrations/napari). If a page is not online yet, this README is the reference.
74
+
75
+ To make a test image with a known value, use the [QR code generator](https://qrcode-ai.com/en-US/qr-code-generator) or the [barcode generator](https://qrcode-ai.com/en-US/barcode-generator). Open the exported image in napari, scan it and compare the label of the outline with the text you encoded.
76
+
77
+ ## Status
78
+
79
+ The plugin is on PyPI as
80
+ [`napari-qrcode-barcode-scanner`](https://pypi.org/project/napari-qrcode-barcode-scanner/) 0.1.0.
81
+ The engine repository published that version from its tag `napari-v0.1.0`, after the owner's
82
+ review, through PyPI trusted publishing: no token is stored. The files on PyPI are the sdist and
83
+ the wheel that the tag's run built, checked with `twine check --strict`, installed in a new
84
+ environment and tested on the sample in the three profiles. The plugin has also run in a napari
85
+ window, from its dock widget, as the picture below shows.
86
+
87
+ napari's plugin manager and the
88
+ [napari hub](https://napari-hub.org/plugins/napari-qrcode-barcode-scanner) read napari's plugin
89
+ index, which is rebuilt once a day, so they can list the plugin a day or so after its PyPI release.
90
+ What the listing shows, and where each value comes from, are in
91
+ [LISTING.md](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/integrations/napari/LISTING.md).
92
+
93
+ ## Install
94
+
95
+ Install the plugin from PyPI in the environment that runs napari:
96
+
97
+ ```sh
98
+ python -m pip install napari-qrcode-barcode-scanner
99
+ ```
100
+
101
+ Or, in napari, choose **Plugins**, **Install/Uninstall Plugins**, search for `qrcode`, install
102
+ **QR Code & Barcode Scanner** and restart napari.
103
+
104
+ Its dependencies are numpy, magicgui and the engine wheel
105
+ [`qrcode-barcode-scanner`](https://pypi.org/project/qrcode-barcode-scanner/0.11.0/) 0.11.0. As napari
106
+ plugins do, it does not install napari or Qt: use the napari you have, or install the plugin with
107
+ its `all` extra, `python -m pip install "napari-qrcode-barcode-scanner[all]"`, to get both.
108
+
109
+ To try a change to the plugin, install the folder from a checkout of this repository instead:
110
+ `python -m pip install ./integrations/napari`.
111
+
112
+ ## Use
113
+
114
+ Open an image, then choose **Plugins**, **Scan QR codes and barcodes (QR Code & Barcode Scanner)**.
115
+ Pick the image layer, a profile and a time budget, and press **Run**.
116
+
117
+ <p align="center">
118
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/integrations/napari/media/napari-window.png" alt="A napari window: the sample image with its QR code and its Code 128 barcode outlined and labelled in a new shapes layer, the layer list, and the plugin's form with the layer, profile and budget fields" width="100%">
119
+ </p>
120
+
121
+ - `profile`: `fast` (the default) suits uploads and gives a reduced quality score. `frame` gives
122
+ no score. `full` searches deepest and gives the full score; artistic QR codes from a generator
123
+ need it.
124
+ - `budget_ms`: a time limit in milliseconds. `0`, the default, means no limit.
125
+
126
+ The plugin adds a shapes layer named after the image, such as `sample codes`. A QR code or another
127
+ matrix code is outlined by its four corners. A barcode is drawn as the line the reader scanned
128
+ across it. Each shape is labelled with its format and text, and the full report is in the layer's
129
+ metadata, under `qrcode_barcode_scanner`. A notification sums up what was read. A new scan of the
130
+ same image replaces that layer; a scan that finds nothing removes it.
131
+
132
+ From a script, `scan_layer` returns the same result as napari layer data:
133
+
134
+ ```python
135
+ from napari_qrcode_barcode_scanner import scan_layer
136
+
137
+ data, meta, kind = scan_layer(viewer.layers["sample"], profile="full", budget_ms=0)
138
+ print([text for text in meta["features"]["text"]])
139
+ ```
140
+
141
+ ## Limits
142
+
143
+ - It reads 2D images: grey, RGB or RGBA. A stack or a volume is refused with a way out: split the
144
+ stack with **Layers**, **Split Stack**, or project it first. A multiscale image is read at its
145
+ full resolution.
146
+ - The pixels pass through the layer's contrast limits, as napari shows them. The layer's data is
147
+ only read.
148
+ - An image wider or taller than 10,000 pixels, or above 64 million pixels, is refused with the
149
+ engine's `QRS-` code.
150
+ - The scan runs while napari waits. A `full` scan of a large image can take seconds: set a budget
151
+ for those.
152
+
153
+ ## Develop
154
+
155
+ The tests call the widget function on napari's own layer classes and its viewer model, the model
156
+ behind the window:
157
+
158
+ ```sh
159
+ python -m venv .venv
160
+ .venv/bin/python -m pip install ./integrations/napari -r integrations/napari/tests/requirements.txt
161
+ .venv/bin/python -m pytest integrations/napari/tests
162
+ ```
163
+
164
+ They scan the sample in the three profiles, and grey, float, 16-bit, offset and RGBA layers. They
165
+ check that the pixels reach the engine unchanged, that the image layer is untouched, that a new
166
+ scan replaces the codes layer, and that stacks, bad options and refused sizes fail clearly. They
167
+ also check the manifest as napari discovers it and the form magicgui builds. The workflow
168
+ `integration-python-hosts` of the engine repository runs them on the built wheel, in a new
169
+ environment. The same workflow opens a napari window on a virtual display, with PyQt6, adds the
170
+ plugin's widget, runs a `full` scan of the sample and checks that both codes are outlined. It keeps
171
+ a picture of that window: `tests/capture_window.py` takes it, and `media/napari-window.png` is the
172
+ one above.
173
+
174
+ ## How it works
175
+
176
+ <p align="center">
177
+ <picture>
178
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/how-python-dark.gif?v=60b4945fed7e">
179
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/.github/main/profile/assets/how-python-light.gif?v=bb48f1698ce2" alt="How the Python package works, in three steps: install the package, pass an image or a camera frame to the engine inside your process, and read the report" width="100%">
180
+ </picture>
181
+ </p>
182
+
183
+ The plugin reads the layer's 2D plane, maps it through its contrast limits to RGBA pixels and passes them to the engine, which runs in napari's Python process. Each scan gives one report.
184
+
185
+ ## What it returns
186
+
187
+ <p align="center">
188
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#examples">
189
+ <picture>
190
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/examples-mixed-dark.png?v=385593c1c18d">
191
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/examples-mixed-light.png?v=7f958679adcc" alt="A QR code and Code 128 decoded from the same image, each outlined where the engine measured it" width="100%">
192
+ </picture>
193
+ </a>
194
+ </p>
195
+
196
+ The picture is a recorded scan of the sample image, which holds a QR code and a Code 128 barcode.
197
+ Both come back in one report, each with its format, its exact text and the place where the engine
198
+ measured it: `https://qrc-ai.com/76xMa` and `STOCK-4827`.
199
+
200
+ The plugin returns a shapes layer: one shape per place the engine measured a code, with the code's `text` and `symbology` as features. The layer has the image's scale, translation, rotation, shear and affine transform, so the outlines sit on the codes.
201
+
202
+ The report itself is described field by field in the
203
+ [report reference](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/v0.11.0/docs/api/report.mdx).
204
+ An empty list of detections means the image holds no code the engine could read. A refused file
205
+ is an error with a `QRS-` code instead, listed in the
206
+ [error codes](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/v0.11.0/docs/api/errors.mdx).
207
+
208
+ ## What it reads
209
+
210
+ <p align="center">
211
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#supported-formats">
212
+ <picture>
213
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/formats-dark.gif?v=92fa0e8084df">
214
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/formats-light.gif?v=bdfe5fc5f9b3" alt="The code families the engine reads: QR codes, matrix and stacked codes such as Data Matrix, retail barcodes such as EAN-13, and other linear barcodes such as Code 128" width="100%">
215
+ </picture>
216
+ </a>
217
+ </p>
218
+
219
+ | Family | Formats |
220
+ |---|---|
221
+ | QR | QR Code, Micro QR, rectangular Micro QR (rMQR) |
222
+ | Matrix and stacked | Data Matrix, Aztec, PDF417, MaxiCode |
223
+ | Retail | EAN-13, EAN-8, UPC-A, UPC-E |
224
+ | Other linear | Code 128, Code 39, Code 93, Codabar, ITF, GS1 DataBar, GS1 DataBar Expanded, Telepen |
225
+
226
+ The plugin reads what the engine reads. Codes of different formats in one image come back in one report. The engine's
227
+ [supported formats](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#supported-formats)
228
+ section states the known limits.
229
+
230
+ ## The same engine in other runtimes
231
+
232
+ <p align="center">
233
+ <a href="https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#get-started">
234
+ <picture>
235
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/runtimes-dark.png?v=57c63428574b">
236
+ <img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/runtimes-light.png?v=6dbd5a8cf5ba" alt="One engine in the language you write: Rust on crates.io, Node.js and the browser on npm, Python on PyPI, Go, PHP, and the qrscan command line" width="100%">
237
+ </picture>
238
+ </a>
239
+ </p>
240
+
241
+ | Runtime | Package | How it scans |
242
+ |---|---|---|
243
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-rust-dark.png?v=31b5deebc32e"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-rust-light.png?v=c5207721973f" alt="" width="24" height="24" align="absmiddle"></picture> Rust | [`qrcode-barcode-scanner`](https://crates.io/crates/qrcode-barcode-scanner) on crates.io | In process |
244
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-nodejs-dark.png?v=cf2159524fc6"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-nodejs-light.png?v=6dd098480218" alt="" width="24" height="24" align="absmiddle"></picture> Node.js | [`@qrcode-ai-com/qrcode-barcode-scanner`](https://www.npmjs.com/package/@qrcode-ai-com/qrcode-barcode-scanner) on npm | In process, native |
245
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-browser-dark.png?v=bbe2f3560a6d"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-browser-light.png?v=591e304cf9e9" alt="" width="24" height="24" align="absmiddle"></picture> Browser | [`@qrcode-ai-com/qrcode-barcode-scanner-wasm`](https://www.npmjs.com/package/@qrcode-ai-com/qrcode-barcode-scanner-wasm) on npm | In the page, WebAssembly |
246
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-python-dark.png?v=7469c3e0b4fb"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-python-light.png?v=308121255ab7" alt="" width="24" height="24" align="absmiddle"></picture> Python | [`qrcode-barcode-scanner`](https://pypi.org/project/qrcode-barcode-scanner/) on PyPI | In process |
247
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-go-dark.png?v=b6dbac901176"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-go-light.png?v=1983a9eb7344" alt="" width="24" height="24" align="absmiddle"></picture> Go | [`qrcode-barcode-scanner-go`](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-go) | Through the installed `qrscan` |
248
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-php-dark.png?v=3800932934c8"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-lang-php-light.png?v=7bdd6884b3a4" alt="" width="24" height="24" align="absmiddle"></picture> PHP | [`qrcode-barcode-scanner-php`](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-php) | Through the installed `qrscan` |
249
+ | <picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-terminal-dark.png?v=1e987f0ab278"><img src="https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/docs/assets/brand/mark-terminal-light.png?v=2262d66bee6b" alt="" width="24" height="24" align="absmiddle"></picture> Command line | [`qrscan`](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust#command-line) | One command, one JSON report |
250
+
251
+ The Rust, Node.js, browser and Python packages hold the engine. The Go and PHP packages hold no decoder:
252
+ each one starts `qrscan` and hands you its report.
253
+
254
+ <sub>Language and platform names and logos belong to their owners. They identify a runtime or a destination and imply no endorsement.</sub>
255
+
256
+ ## Licence
257
+
258
+ Project-authored plugin source is MIT; see [LICENSE](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/integrations/napari/LICENSE). The plugin installs the engine wheel `qrcode-barcode-scanner` 0.11.0 from PyPI and does not ship it. The published engine 0.11.0 keeps the license it shipped with, AGPL-3.0-or-later; read the license packaged with the version you install and the [licensing guide](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/LICENSING.md).
259
+
260
+ Maintained by **Thibaut Mélen & Nicolas Cella** for **QR Code AI**, a product of **SuperNovae Studio**. The license of each component is stated in its own license files.
261
+
262
+ <!-- qrscan-source-license:v1 -->
263
+
264
+ ## Source license
265
+
266
+ Project-authored scanner code and documentation in this checkout are available under the [MIT License](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/LICENSE). You may use, modify and redistribute this source in open-source or proprietary applications, including commercial products, while preserving the copyright and permission notice. Thibaut Mélen & Nicolas Cella develop QR Code AI at SuperNovae Studio.
267
+
268
+ Retained third-party code, dependencies, artwork and test data keep their own licenses and notices. The [licensing guide](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/LICENSING.md) explains these component boundaries; the project license does not assign a license to an unrelated platform or service.
269
+
270
+ Published archives retain the license shipped with their version. A pinned engine, adapter or bundle may therefore have different terms from this working source. Read its packaged license and the [license history](https://github.com/qrcode-ai-com/qrcode-barcode-scanner-rust/blob/main/docs/guides/license-history.mdx) before reuse. The source change does not replace an archive or publish a new version.
271
+
272
+ <!-- /qrscan-source-license:v1 -->
@@ -0,0 +1,13 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ pyproject.toml
5
+ src/napari_qrcode_barcode_scanner/__init__.py
6
+ src/napari_qrcode_barcode_scanner/_widget.py
7
+ src/napari_qrcode_barcode_scanner/napari.yaml
8
+ src/napari_qrcode_barcode_scanner.egg-info/PKG-INFO
9
+ src/napari_qrcode_barcode_scanner.egg-info/SOURCES.txt
10
+ src/napari_qrcode_barcode_scanner.egg-info/dependency_links.txt
11
+ src/napari_qrcode_barcode_scanner.egg-info/entry_points.txt
12
+ src/napari_qrcode_barcode_scanner.egg-info/requires.txt
13
+ src/napari_qrcode_barcode_scanner.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [napari.manifest]
2
+ napari-qrcode-barcode-scanner = napari_qrcode_barcode_scanner:napari.yaml
@@ -0,0 +1,6 @@
1
+ numpy>=1.24
2
+ magicgui>=0.8
3
+ qrcode-barcode-scanner==0.11.0
4
+
5
+ [all]
6
+ napari[all]