Ceci est une ancienne révision du document !
Docs:
Installer la librairie libdmtx sur le système :
sudo apt install libdmtx0b
Installer les modules Python :
pip install pylibdmtx pip install pillow
Générer un Datamatrix :
from pylibdmtx.pylibdmtx import encode from PIL import Image encoded = encode("Hello world !".encode('utf8')) img = Image.frombytes('RGB', (encoded.width, encoded.height), encoded.pixels) img.save("example.png")
Source: https://www.youtube.com/watch?v=y9VXWsU3FSE
Doc du module : https://pypi.org/project/qrcode/
Installation des paquets :
pip install qrcode pip install pillow
Génération simple d'un QR Code :
import qrcode img = qrcode.make("Bonjour tout le monde !") img.save("exemple.png")
Génération d'un QR Code personnalisé :
import qrcode qr = qrcode.QRCode( box_size=20, border=10 ) qr.add_data("Hello world !") qr.make(fit=True) img = qr.make_image(fill_color="blue", back_color="white") img.save("example.png")