QR Code creation from the command line

The command line script segno can be used to print QR codes to the terminal or to save them in supported formats like SVG, PNG, EPS, …, see CLI man page for details

By default, the script does not create Micro QR codes, use --micro to allow the creation of Micro QR codes or specify the version (like --version=M3) to create a Micro QR Code.

See the CLI man page for a detailed reference of all command line options.


Output the QR code to the terminal:

$ segno "Little wing"
QR code for "Little wing".

Same content, but as Micro QR code (M4):

$ segno --micro "Little wing"
Micro QR code for "Little wing".

Using a more compact representation of the code:

$ segno --compact "Little wing"
QR code for "Little wing" in a more compact manner.

QR Code version

If the --version / -v parameter is not provided, Segno chooses the minimal version for the QR code automatically. The version may be specified as an integer or as Micro QR Code identifier.

The content ‘Layla’ would fit into a 1-H QR code, but the following commands enforce version 5:

$ segno --version=5 Layla
$ segno -v=5 Layla
QR code version 5 for "Layla".

Micro QR Code:

$ segno -v m4 Layla
$ segno --version M4 Layla
Micro QR code version M4 for "Layla".

QR Code error correction level

The default error correction level is “L” (or any better if --no-error-boost was not set, c.f. Boost error correction level), use the --error / -e parameter to change it:

$ segno --error=q "Ain't no grave"
$ segno -e=h "Heart of Gold"

QR code serialization

Printing the QR code to the terminal is nice but the --output / -o parameter serializes the QR code in one of the supported file formats:

$ segno --output=white-room.png "White Room"
QR code "White Room".
$ segno -o=satellite.svg "Satellite Of Love"
QR code "Satellite Of Love".
$ segno --output=mrs.eps "Mrs. Robinson"
$ segno --output=dedodo.pdf "De Do Do Do, De Da Da Da"
$ segno --output=tin-pan-alley.svgz "Tin Pan Alley"
$ segno --output=thrill-gone.txt "The Thrill Is Gone"

Scaling QR codes

If the resulting QR code is too small, --scale or -s can be used to create a more appropriate output:

$ segno --scale=10 --output=money-talks.png "Money Talks"
QR code "Money Talks".
$ segno -s 10 --output=private-investigations.svg Private Investigations
QR code "Private Investigations".

If the serializer does not support a scaling factor (i.e. text output), this parameter is ignored.

Changing the size of the quiet zone

The generated QR code will have a recommended quiet zone / border around the symbol. To change the size of the border, --border or the shortcut -b can be utilized:

$ segno --border 0 --scale 4 --output=black-magic-woman.svg "Black Magic Woman"
QR code "Black Magic Woman" using quiet zone of zero.
$ segno --border 10 --scale 4 --output diamond.png "Shine On You Crazy Diamond"
QR code "Shine On You Crazy Diamond" using quiet zone of ten.
$ segno -b 30 --scale 4 --output=boom-boom.svg Boom Boom
QR code "Boom Boom" using quiet zone of 30.


Usually, all QR codes are serialized in black and white. Use --dark to change the color of the dark modules and --light to change the color of the light modules.

Change the color of the dark modules to to darkblue:

$ segno --dark=darkblue --scale 4 --output=excited.png "So Excited"
QR code "So Excited" with foreground color "darkblue"

Change the color of the light modules to transparent:

$ segno --light=transparent --scale 4 --output=hotel.png "Hotel California"
QR code "Hotel California" with background color "transparent"

Change the color of the dark modules to darkblue and the color of the light modules to yellow:

$ segno --dark=darkblue --light=yellow --scale 4 --output=dontgiveup.svg "Don't Give Up"
QR code "Don't Give Up" with foreground color "transparent"

If the serializer does not support --color or --light, these arguments are ignored.

The SVG, PNG and PPM serializers support more than two colors, each module type (finder pattern (dark / light), alignment pattern (dark / light) etc.) may have its own color, see Colorful QR Codes for details.

$ segno --dark darkred --data-dark darkorange --data-light yellow --scale 5 -o qrcode_yellow-submarine.png Yellow Submarine
QR code "Yellow Submarine" colorful

Structured Append

The Structured Append mode can be used to split a message across multiple (max. 16) QR codes.

To create a sequence of QR codes, the --seq argument must be provided. Additionally, either the --version or the desired number of symbols (--symbol-count) must be provided:

$ segno --seq -v 1 --scale 3 -o polythene-pam.png "Well you should see Polythene Pam"
1st part of Structured Append code 2nd part of Structured Append code 3nd part of Structured Append code

Specify the max. number of symbols:

$ segno --seq --symbol-count=2 -s 3 -o sa_yellow-submarine.png "We all live in a yellow submarine"
1st part of Structured Append code 2nd part of Structured Append code

Shortcut to specify the number of symbols:

$ segno --seq -sc 2 -s 3 -o julia.png "Half of what I say is meaningless"
1st part of Structured Append code 2nd part of Structured Append code