A command line tool that generates QR codes and outputs them as a PNG file. You can supply command line arguments to set the input text, ECC level, mask, and min/max version of the QR code. There are also command line argument that are used to set the outputted image scale and foreground/background color. A helpful command line argument, --verify, is used to visualize what the QR code will look like before saving the image to disk. Also, --quiet, that will supress and text outputted to the terminal, except if any error occurs. You can set the QR code text via stdin or a command line argument. Provide an output file via a command line argument to save the image somewhere on disk.
# Building
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release .. # It may take a little bit!
make -j 8
# Installing
sudo make install
# Input text via command line argument
./build/qrtool \
--text-input "https://github.com/REDl3east/qrtool" \
--error-correction-level "high" \
--mask 5 \
--version-min-range 10 \
--version-max-range 20 \
--foreground-color "#153801ff" \
--background-color "#e5fad9ff" \
--scale 3 \
--output "./assets/example1.png"
# Input text via stdin, also add transparency to background, and boost ECC if needed.
# If text is inputted via the keyboard then press Ctrl+D to continue.
printf "%s" "What are you looking at?" | ./build/qrtool \
--error-correction-level "low" \
--mask 7 \
--version-min-range 1 \
--version-max-range 10 \
--foreground-color "#2f3c7e77" \
--background-color "#fbeaeb77" \
--scale 5 \
--boost-ecc \
--output "./assets/example2.png"
# Input text via command line argument and verify the QR code before saving.
# Also supress any outputted text to terminal.
./build/qrtool \
--text-input "This is some really long text. There once was a guy named Jim who lived in the middle of Nowhere. He lived with a nice pink dog named Aaudacious. :)" \
--error-correction-level "high" \
--mask 3 \
--version-min-range 10 \
--version-max-range 20 \
--foreground-color "#ee4e34ff" \
--background-color "#fceddaff" \
--scale 3 \
--output "./assets/example3.png" \
--verify \
--quiet
The input text that will be used to generate the QR code
The Error Correction Level of the QR Code. [LOW | MEDIUM | QUARTILE | HIGH | L | M | Q | H] (Default is high)
The mask used to generate the QR code. [0 | 1 | 2 | 3 | 4 | 5 | 6 | 7] (If this option is absent, then the mask is automatically selected)
If present, this option will increase the error correction level if needed.
The max version of the QR code. (1-40 and if absent, default to 40)
The min version of the QR code. (1-40 and if absent, default to 1)
The foreground color of the QR code. Use hex notation: #RRGGBBAA (Default is black)
The background color of the QR code. Use hex notation: #RRGGBBAA (Default is white
The scale of the outputted qr code. (Default is 1.0)
The outputted image of the QR code.
Show the image before saving the image. Press 'y' to save image and 'n' to cancel saving.
Only output text if there is an error. --help and --version will still output text.
print this help and exit
print version information and exit
- cmake 3.0.0+
- SDL2
- SDL_image
- QR-Code-generator
- argtable3
Cmake will take care of all dependancies, so you really only need the correct cmake version to build and install.