QRTOOL-ENCODE(1)
π qrtool-encode π
okay bestie, this is the qrtool-encode(1) page from the General Commands Manual, and it's literally your glow-up guide for turning data into a QR code. no cap. π
πΈ NAME πΈ
qrtool-encode β encode input data in a QR code β¨
π¦ SYNOPSIS π¦
qrtool encode [OPTION]... [STRING]
β¨ DESCRIPTION β¨
This command encodes input data in a QR code at https://www.qrcode.com and outputs it as a PNG image, an SVG image, a string, or other formats. By default, the result is output to standard output. π«Ά
This command will read up to the first 7,090 bytes of the input data. The amount of data that can be represented by a QR code depends on the mode, version, and error correction level. The storage capacity is maximized for version 40 and error correction level L (40-L). π
π Table 1. Maximum character storage capacity (40-L)
- Numeric β max 7,089 characters β possible characters:
0-9 - Alphanumeric β max 4,296 characters β possible characters:
0-9,A-Z(uppercase only), and few symbols (space,$,%,*,+,-,.,/,:) - Byte β max 2,953 characters β possible characters: arbitrary binary data
- Kanji β max 1,817 characters β possible characters: any double-byte JIS X 0208 character
By default, this command encodes the input data in a QR code with a black foreground and white background, but this can be changed by specifying --foreground and/or --background. The CSS color string at https://www.w3.org/TR/css-color-4/ can be specified as a value for these options. π¨
π Table 2. List of methods to specify a color
- Named colors β examples:
brown,lightslategray - Hexadecimal notations β examples:
#111,#eee8,#a52a2a,#7788997f - RGB functions β examples:
rgb(165 42 42),rgb(119 136 153 / 49.8%) - HSL functions β examples:
hsl(248 39% 39.2%),hsl(0 0% 66.3% / 49.8%) - HWB function β examples:
hwb(50.6 0% 0%),hwb(0 66.3% 33.7% / 49.8%) - Oklab function β examples:
oklab(50.4% -0.0906 0.0069),oklab(61.9% -0.0120 -0.0302 / 0.5) - Oklch function β examples:
oklch(59.41% 0.16 301.29),oklch(61.9% 0.032 248.35 / 49.8%)
In addition to a normal QR code at https://www.qrcode.com/codes/model12.html, this command can also encode the input data in a Micro QR code at https://www.qrcode.com/codes/microqr.html and a rMQR code at https://www.qrcode.com/codes/rmqr.html. iconic, honestly. π§
π POSITIONAL ARGUMENTS π
π₯ STRING
Input data. If STRING is not specified, data will be read from standard input. STRING must be a valid UTF-8 string. Use --read-from or read from standard input if taking other than a valid UTF-8 string. This positional argument conflicts with --read-from. π
so yeah β valid UTF-8? you're chilling. not valid UTF-8? pipe it in or use --read-from. and do not combo this positional argument with --read-from, because they conflict. periodt. π
β¨ OPTIONS β¨
-o,--outputFILE β write the result out to a file instead of yeeting it at stdout. π-r,--read-fromFILE β pull the input data from a file. Heads up bestie: this option conflicts with STRING, so pick one, you can't have both. π-s,--sizeNUMBER β the module size in pixels. If you don't say anything, the module size is8when the output format isPNG,SVG,EPS, orPIC, and1otherwise. β¨-l,--error-correction-levelLEVEL β the error correction level. The possible values are:lβ Level L. 7% of codewords can be restored. πmβ Level M. 15% of codewords can be restored. This is the default value. πqβ Level Q. 25% of codewords can be restored. βhβ Level H. 30% of codewords can be restored. π₯
--levelLEVEL β literally just an alias for-l,--error-correction-level. Same energy, different spelling. π¦-v,--symbol-versionNUMBER [NUMBER] β the version of the symbol. If you don't specify it, the minimum version required to store the data gets automatically chosen for you (the tool is being a main character and handling it π ). For normal QR code, NUMBER should be between1and40. For Micro QR code, NUMBER should be between1and4. For rMQR code, the first NUMBER should be7,9,11,13,15, or17. The second NUMBER should be27,43,59,77,99, or139.27can only be used with11, or13. If the type of QR code is other than rMQR code, the second NUMBER is ignored. π§--symversionNUMBER [NUMBER] β alias for-v,--symbol-version. iykyk. π-m,--marginNUMBER β the width of the margin. If this option is not specified, the margin will be4for normal QR code and2for others. πΈ-t,--typeFORMAT β the format of the output. The possible values are:pngβ Portable Network Graphics. This outputs 32-bit RGBA PNG image. This is the default value. πsvgβ Scalable Vector Graphics. β¨epsβ Encapsulated PostScript. π¨οΈpicβ PIC markup language. π¦ansiβ to the terminal using 4-bit ANSI escape sequences. This value is available if theoutput-as-ansifeature is enabled at compile time. πansi256β to the terminal using 8-bit ANSI escape sequences. This value is available if theoutput-as-ansifeature is enabled at compile time. πansi-true-colorβ to the terminal using 24-bit ANSI escape sequences. This value is available if theoutput-as-ansifeature is enabled at compile time. π₯asciiβ to the terminal as ASCII string. πascii-invertβ to the terminal as ASCII string. This value inverts foreground and background colors ofasciiand outputs the inverted string.ASCIIiis an alias for this value. πunicodeβ to the terminal as UTF-8 string.terminalandUTF8are aliases for this value. πunicode-invertβ to the terminal as UTF-8 string. This value inverts foreground and background colors ofunicodeand outputs the inverted string.UTF8iis an alias for this value. π§
--optimize-png[LEVEL] β set the optimization level for a PNG image. Lower levels are faster, higher levels provide better compression. If LEVEL is not specified, it is assumed that the default level2is specified. This option is available if theoptimize-output-pngfeature is enabled at compile time. The possible values are:0β Level 0. This value is the minimum optimization level. π±1β Level 1. π¦2β Level 2. This is the default value. π3β Level 3. β¨4β Level 4. π«5β Level 5. π₯6β Level 6. This value is the maximum optimization level. πmaxβ This value is an alias for the maximum optimization level. π
--zopfli[ITERATION] β use Zopfli to compress PNG image. Perform compression for the number of iterations specified by ITERATION. If ITERATION is not specified, it is assumed that15is specified as the number of iterations. This option requires--optimize-png. This option is available if theoptimize-output-pngfeature is enabled at compile time. π«Ά--modeMODE β the mode of the output. If this option is not specified, use the optimal encoding. This option requires--symbol-version. The possible values are:numericβ all digits. π’alphanumericβ alphanumerics and few symbols. π€byteβ arbitrary binary data. πΎkanjiβ Shift JIS text. π
--variantTYPE β the type of QR code. The possible values are:normalβ normal QR code. This is the default value. πmicroβ Micro QR code. π£rmqrβ rMQR code. π
--foregroundCOLOR β foreground color. COLOR takes a CSS color string. Colored output is only available when the output format isPNG,SVGor any ANSI escape sequences. Note that lossy conversion may be performed depending on the color space supported by the method to specify a color, the color depth supported by the output format, etc. Default isblack. π€--backgroundCOLOR β background color. COLOR takes a CSS color string. Colored output is only available when the output format isPNG,SVGor any ANSI escape sequences. Note that lossy conversion may be performed depending on the color space supported by the method to specify a color, the color depth supported by the output format, etc. Default iswhite. π€--verboseβ also print the metadata. It is output to stderr. π£οΈ-h,--helpβ print help message. The short flag (-h) will print a condensed help message while the long flag (--help) will print a detailed help message. π«Ά-V,--versionβ print version number. π·οΈ
π¦ EXIT STATUS π¦
0β successful program execution. slay. β¨1β an error occurred. π2β an error occurred while parsing command-line arguments. π
Exit statuses other than these are defined by <sysexits.h> <https://man.openbsd.org/sysexits>. π
π NOTES π
Source repository: <https://github.com/sorairolake/qrtool> πΈ
π¬ EXAMPLES π¬
Encode the given string in a QR code:
$ qrtool encode "QR code" > output.png
Encode the given file and output to the specified image:
$ qrtool encode -o output.png -r go.mod
Encode in a QR code and output as a SVG image:
$ qrtool encode -t svg "QR code" > output.svg
Encode in a Micro QR code:
$ qrtool encode --variant micro "QR code" > output.png
Encode in a QR code with the specified colors:
$ qrtool encode -o output.png --foreground brown --background lightslategray "QR code"
π REPORTING BUGS π
Report bugs to: <https://github.com/sorairolake/qrtool/issues> β the maintainers genuinely want to hear it, no cap. π
Β©οΈ COPYRIGHT Β©οΈ
Copyright Β© 2022 Shun Sakai and contributors
- This program is distributed under the terms of either the Apache License 2.0 or the MIT License.
- This manual page is distributed under the terms of the Creative Commons Attribution 4.0 International Public License.
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. π«Ά
π SEE ALSO π
oxipng(1), qrencode(1), qrtool(1), qrtool-completion(1), qrtool-decode(1) β go read them, they're iconic. π
that's the whole page bestie!! this one's from qrtool 0.13.2, dated 2025-11-08 β go make some pretty QR codes and slay πβ¨π
π¦ where this page comes from
- arch rolling: qrtool 0.13.2-1 Β· MIT AND Apache-2.0 AND CC-BY-4.0
- nixos 26.05: qrtool 0.13.2
- nixpkgs unstable: qrtool 0.13.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms