Fundamentals 6 min read

Create Custom QR Codes (including Art & GIF) with One Line of Python

This guide shows how to install the myqr Python tool and use simple command‑line options to generate standard, artistic, and animated QR codes, customize size, error correction, filenames, colors, contrast, and even run a packaged EXE without Python installed.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Create Custom QR Codes (including Art & GIF) with One Line of Python

Today I discovered a popular GitHub project that can generate QR codes on any OS with a single line of code, supporting normal, artistic (black‑white/color), and animated GIF QR codes. The project has over 6200 stars.

Install the tool via pip: pip3 install myqr After installation you can create a basic QR code:

# myqr  QR code content
>myqr http://weixin.qq.com/r/khy5oY7EN9NIrcrC90mA

The command creates qrcode.png in the current directory. Use -n to set a custom filename and -d to specify a directory, e.g.:

myqr http://weixin.qq.com/r/khy5oY7EN9NIrcrC90mA -n Python3X.jpg -d E:\

You can also adjust the size ( -v, range 1‑40) and error‑correction level ( -l, L/M/Q/H, default H):

myqr http://weixin.qq.com/r/khy5oY7EN9NIrcrC90mA -v 10 -l M

To create an artistic QR code, provide an image with -p. For example, using a Peppa Pig picture:

myqr http://weixin.qq.com/r/khy5oY7EN9NIrcrC90mA -p peiqi.jpg

If the result is black‑and‑white, add -c to color the image:

myqr http://weixin.qq.com/r/khy5oY7EN9NIrcrC90mA -p peiqi.jpg -c

Contrast ( -con) and brightness ( -bri) can be modified, defaulting to 1.0.

Animated QR codes work the same way but require a GIF image and usually need -c for coloring:

myqr http://weixin.qq.com/r/khy5oY7EN9NIrcrC90mA -p pig.gif -n Python3X.gif -c

An executable version packaged with PyInstaller is also available for systems without Python. Create an info.txt file in the same folder with parameters, for example:

# QR code content
words=http://weixin.qq.com/r/khy5oY7EN9NIrcrC90mA
# size
v=11
# image (gif) path
p=pig.gif
# output name
n=Python3X.gif
# color
C

Remove the Chinese comments before running, then execute myqr.exe to generate the QR code. If it fails, run the exe from a command prompt.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

QR codeGIFmyqrartistic
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.