🔳 qrstyle
rounded |
square |
dots |
|---|---|---|
Styled QR codes for Python
Rounded, square or dots, with a logo in the centre. Draws to a Pillow image, PNG or WEBP bytes, or a file.
Installation
pip install qrstyle
Usage
import qrstyle
code = qrstyle.make("https://example.com")
code.save("qrcode.png", 512) # format from the extension: .png or .webp
image = code.to_image(512) # PIL.Image, 512 x 512
data = code.to_bytes(512, "webp") # "png" by default
In async code:
code = await qrstyle.amake("https://example.com")
data = await code.ato_bytes(512)
Everything make() accepts:
code = qrstyle.make(
"https://example.com", # text to encode
style="rounded", # "rounded" | "square" | "dots", the logo follows it
logo=None, # PNG or JPEG bytes, up to 5 MB and 4096 x 4096 px
)
The logo goes in as bytes, from a file or downloaded by URL:
from pathlib import Path
from urllib.request import urlopen
logo = Path("logo.png").read_bytes()
# or: logo = urlopen("https://example.com/logo.png", timeout=10).read()
code = qrstyle.make("https://example.com", style="dots", logo=logo)
Errors
DataTooLongError— the text does not fit a QR code or the size;code.min_sizeis the smallest size that fitsLogoError— the logo is not a PNG or JPEG, or is over 5 MB or 4096 x 4096 pxValueError— a wrong style or format, or a size over 4096
DataTooLongError and LogoError are QRError.
HTTP API
The same codes over HTTP, in api/:
git clone https://github.com/nessshon/qrstyle.git && cd qrstyle/api
docker compose up -d --build
GET /create returns an image:
| Parameter | Default | Description |
|---|---|---|
data |
required | Text to encode |
size |
medium |
small, medium or large: 256, 512, 1024 px |
format |
png |
png or webp |
style |
rounded |
rounded, square or dots |
logo |
— | URL of a PNG or JPEG |
curl -G https://example.com/create \
--data-urlencode "data=https://example.com" \
--data-urlencode "logo=https://example.com/logo.png" \
-d style=dots -o qrcode.png
Errors come as JSON {"detail": "..."}
400— the logo can't be used or the text does not fit422— a wrong parameter
License
This repository is distributed under the MIT License.
Metadata
Release files for qrstyle 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qrstyle-1.1.0.tar.gz | 10.9 kB | Without provenance | Details for qrstyle-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qrstyle-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for qrstyle-1.1.0-py3-none-any.whl |
Total release size: 21.2 kB
Release files / qrstyle-1.1.0.tar.gz
| Download URL | qrstyle-1.1.0.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cccffc8a58e62905cec02e3731227b62528bac46ec6430bb9484c3daa8836191
|
|
BLAKE2b-256 checksum How to use checksums |
97f772c725950d946f56e5d555d00a45b61937e2c3dbdb2888ab5106062bbafe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / qrstyle-1.1.0-py3-none-any.whl
| Download URL | qrstyle-1.1.0-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80c428f73c6aad87cf017db33cd1cda2012fce30ad2ef887ad367cbd98575e73
|
|
BLAKE2b-256 checksum How to use checksums |
9ea9d61b14c6794b73954492253fc9a0c1ea95b5edd975a6999965febfca6b1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for qrstyle 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.