Q → R → D → E → M → O
Generate looping videos of morphing QR codes.
-
Each character in the input string becomes a separate QR code.
-
Outputs in
mp4andgifformats. -
Supports custom FPS, error level, size, and color.
This code was written with the help of an LLM.
FFmpeg is required: https://ffmpeg.org/
The following Python libraries are required:
pip install qrcode[pil] moviepy numpy# Generate the example image above
python qrmorph.py -i "QR Demo" -o demo.gif -th 0.5 -tt 0.5 --fps 15 --shrink 0.85 --seed 1 --bg-color 000000 --square-color ffffff
# Generate a basic black-and-white QR code as an mp4
python qrmorph.py -i "basic" -o basic.mp4Required:
-i, --input (string) - The text to transform into QR codes. Ex: "This is a message"
-o, --output (string) - The output file. mp4 or gif format. Ex: "message.gif"
Optional:
-v, --version (Integer, 1-40, default 4) - The QR code version: higher=larger QR code
--ecc ("M" or "H", default "H") - Error correction level: H is ~30% more robust but uses more space
--border (Integer, default 4) - Quiet zone (white border) around each QR code
--tile (Integer, default 20) - Pixels per QR module; larger values = higher resolution
--shrink (Float, 0.7-1.0, default 0.86) - How much to shrink each square tile
--framepad (Integer, default 0) - Extra padding pixels around the entire QR code
--square-color (String, default "#000000") - Color of the QR modules/squares (hex, RGB, or gray)
--bg-color (String, default "#ffffff") - Background color for the whole frame (hex, RGB, or gray)
--fps (Integer, default 30) - Frames per second; higher = smoother but larger file
-th, --hold (Float seconds, default 0.6) - How long to display each QR code statically
-tt, --transition (Float seconds, default 1.2) - Duration of transition between QR codes
--seed (Integer, default 42) - Random seed for movement patterns; same seed = identical animations
