---
obj: application
repo: https://github.com/sorairolake/qrtool
rev: 2025-01-30
---

# qrtool
qrtool is a command-line utility for encoding or decoding QR code.

## Usage
### Encode
Usage: `qrtool encode [OPTION]…​ [STRING]`

| Option                               | Description                                                                                                                                                                                                                                                                                                                                     |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-o, --output FILE`                  | Output the result to a file.                                                                                                                                                                                                                                                                                                                    |
| `-r, --read-from FILE`               | Read input data from a file. This option conflicts with `[STRING]`.                                                                                                                                                                                                                                                                             |
| `-s, --size NUMBER`                  | The module size in pixels. If this option is not specified, the module size is 8 when the output format is PNG or SVG, and 1 otherwise.                                                                                                                                                                                                         |
| `-l, --error-correction-level LEVEL` | Error correction level. The possible values are: Level `L`. 7% of codewords can be restored. Level `M`. 15% of codewords can be restored. This is the default value. Level `Q`. 25% of codewords can be restored. Level `H`. 30% of codewords can be restored.                                                                                  |
| `--level LEVEL`                      | Alias for `-l, --error-correction-level`.                                                                                                                                                                                                                                                                                                       |
| `-m, --margin NUMBER`                | The width of margin. If this option is not specified, the margin will be 4 for normal QR code and 2 for Micro QR code.                                                                                                                                                                                                                          |
| `-t, --type FORMAT`                  | The format of the output. The possible values are: `png`, `svg`, `pic`, `ansi256`, `ansi-true-color`, `ascii`, `ascii-invert`, `unicode`, `unicode-invert`                                                                                                                                                                                      |
| `--foreground COLOR`                 | Foreground color. COLOR takes a CSS color string. Colored output is only available when the output format is PNG, SVG or 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 is black. |
| `--background COLOR`                 | Background color. COLOR takes a CSS color string. Colored output is only available when the output format is PNG, SVG or 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 is white. |

### Decode
Usage: `qrtool decode [OPTION]…​ [IMAGE]`

| Option              | Description                                                                                                                                                                                                                                                                   |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `-t, --type FORMAT` | The format of the input. If FORMAT is not specified, the format is determined based on the extension or the magic number. The possible values are: `bmp`, `dds`, `farbfeld`, `gif`, `hdr`, `ico`, `jpeg`, `openexr`, `png`, `pnm`, `qoi`, `svg`, `tga`, `tiff`, `webp`, `xbm` |
