qrtool is a versatile command-line utility designed for encoding and decoding QR codes. Its primary function allows users to convert text or data into QR codes and decode them back efficiently. The tool is known for its flexibility and robustness, making it suitable for various use cases.
Key Features:
Multiple Image Formats Support: qrtool supports a wide range of image formats, including PNG (default), SVG, EPS, PIC, ANSI, ASCII, Unicode, and more. This versatility allows users to generate QR codes in vector graphics or terminal-friendly formats.
Micro QR and rMQR Code Generation: In addition to standard QR codes, qrtool can generate Micro QR and rMQR codes, providing options for different encoding needs and use cases.
Color Customization: Users can customize the foreground and background colors of generated images using CSS color strings, offering a personalized touch to their QR code outputs.
Shell Completions: qrtool provides shell completions for popular shells like bash, zsh, fish, and others, enhancing user experience by offering command suggestions.
Standard Input/Output Integration: The tool reads from standard input and writes to standard output, making it ideal for use in scripts or automated workflows.
External Tool Integration: qrtool integrates seamlessly with external tools like oxipng for image optimization, allowing users to reduce file sizes without compromising quality.
Audience & Benefit:
Ideal for developers, system administrators, and CLI enthusiasts who need a reliable tool for integrating QR code functionality into their scripts or workflows. qrtool offers flexibility, customization, and efficiency, all without the need for graphical interfaces. Its command-line nature makes it perfect for automation and scripting environments, ensuring seamless integration into existing processes.
README
qrtool
qrtool is a command-line utility for encoding or decoding QR code.
Use --foreground and --background options to change the foreground and
background colors of the generated image. These options takes a
CSS color string such as brown, #a52a2a or rgb(165 42 42). The default
foreground color is black and the background color is white of CSS's named
colors.
qrtool encode --foreground brown --background lightslategray "QR code" > output.png
Generate this image:
Colored output is also available when the output format is any ANSI escape
sequences:
qrtool encode -t ansi-true-color --foreground brown --background lightslategray "QR code"
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.
Supported input image formats
qrtool decode supports decoding a QR code from the following image formats:
To support decoding from SVG image, the decode-from-svg feature must be
enabled at compile time. Note that the SVG image is rasterized before scanning.
Image formats other than PNG can be disabled by disabling the default
feature, and can be enabled individually.
Use -t option to specify the image format. If this option is not specified,
the image format is determined based on the extension or the magic number.
Input this WebP image:
Decode a QR code from the WebP image:
$ qrtool decode input.webp
QR code
# or
$ qrtool decode -t webp input.webp
QR code
Generate shell completion
completion subcommand generates shell completions to standard output.
The following shells are supported:
bash
elvish
fish
nushell
powershell
zsh
Example:
qrtool completion bash > qrtool.bash
Integration with other programs
Both qrtool encode and qrtool decode can read from standard input and
output to standard output.
Optimize the output image
The image output by qrtool encode is not optimized. For example, a PNG image
is always output as the 32-bit RGBA format. If you want to reduce the image
size or optimize the image, use an optimizer such as oxipng or
svgcleaner.
If the optimize-output-png feature is enabled, you can also use
--optimize-png option and --zopfli option of this command to optimize
output PNG image.
Reading and writing unsupported image formats
If you want to save the encoded image in an image format other than PNG or SVG,
or decode an image in an unsupported image format, convert it using a converter
such as ImageMagick.
Raster formats
Read Cargo.toml from standard input and save the encoded result as a XPM
image:
Copyright (C) 2022 Shun Sakai and contributors (see AUTHORS.adoc)
This program is distributed under the terms of either the Apache License
2.0 or the MIT License.
Some files are distributed under the terms of the Creative Commons
Attribution 4.0 International Public License.
This project is compliant with version 3.3 of the REUSE Specification. See
copyright notices of individual files for more details on copyright and
licensing information.