# Data : QR Codes
- https://en.wikipedia.org/wiki/QR_code
- https://www.qrcode.com/en/about/standards.html
*aka "quick-response code"*
There are 40 versions, with the side-length increasing by four each time.
| Ver | Size |
| :-: | :---: |
| 1 | 21x21 |
| 2 | 25x25 |
| 3 | 29x29 |
| ... | ... |
> [!NOTE] Decoding QR Codes
> For Ubuntu, install the `zbar-tools` package, then run `zbarimg IMAGEFILE`.
## Python
### qrcode
\[ [PyPi](https://pypi.org/project/qrcode/) | [src](https://github.com/lincolnloop/python-qrcode/) \]
**Dependencies**
Has no hard dependencies.
- If you try to generate a png, it will default to using [pillow](https://pypi.org/project/pillow/) (aka PIL), which it expects to already be installed.
- You can also generate pngs using [pypng](https://pypi.org/project/pypng/) (pure-python) if you install it and stick to the "pure-python" portion of the `qrcode` API.
- SVGs require no additional packages.
**Command Line**
```bash
$ qr "data" > file.png # default to using pillow
$ qr --factory=png "data" > file.png # force to use pypng
```
**API**
```python
import qrcode
from qrcode.image.pure import PyPNGImage
from qrcode.image.svg import SvgPathFillImage
# using pillow
img = qrcode.make( "data" )
img.save( "file.png" )
# using pypng
img = qrcode.make( "data", image_factory=PyPNGImage )
# generating SVG
img = qrcode.make( "data", image_factory=SvgPathFillImage )
img.to_string() -> b"<svg...</svg>"
img.to_string( encoding="unicode" ) -> "<svg...</svg>"
```
See README for advanced usage — like image customization.