🔳 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.0.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 | |
|---|---|---|---|---|
| qrstyle-1.0.0.tar.gz | 10.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qrstyle-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.2 kB
Release files / qrstyle-1.0.0.tar.gz
| Download URL | qrstyle-1.0.0.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8227c177dc7f530ed40ecce2f78993c1446e8d3b5ba08f105070b84f8d9a081
|
|
BLAKE2b-256 checksum How to use checksums |
16214ce126729181cb45d0c69ec1c4a3d63e6e8aa7e579c4bd498d2cbb655426
|
| 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.0.0-py3-none-any.whl
| Download URL | qrstyle-1.0.0-py3-none-any.whl |
|---|---|
| Size | 10.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aab78aa1ad2b7f9c18853c25e288f3d520f19797dfe5a46e9c7162acd42bc1e8
|
|
BLAKE2b-256 checksum How to use checksums |
dc364713465ab8312a3df6480405a25dd6ccb644d5ee56797d31bd84420c571f
|
| 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.0.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.