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.
Usage¶
Output the QR code to the terminal:
$ segno "Little wing"
Same content, but as Micro QR code (M4):
$ segno --micro "Little wing"
Using a more compact representation of the code:
$ segno --compact "Little wing"
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
Micro QR Code:
$ segno -v m4 Layla
$ segno --version M4 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"
$ segno -o=satellite.svg "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"
000000000000000000000000000000000
000000000000000000000000000000000
000000000000000000000000000000000
000000000000000000000000000000000
000011111110101110110011111110000
000010000010111011110010000010000
000010111010100010010010111010000
000010111010111011000010111010000
000010111010100010110010111010000
000010000010001111011010000010000
000011111110101010101011111110000
000000000000110101001000000000000
000001101011000000111010111110000
000010010101000100001110000110000
000000001111000101000100111110000
000000000100010000001100110100000
000011101011001000001010000000000
000001000000100010011110010110000
000010001111000101001011101110000
000001110000100000010101100100000
000010001011110111101111111110000
000000000000110001011000100000000
000011111110110011011010101110000
000010000010001011111000100110000
000010111010101100101111100010000
000010111010010110101001111000000
000010111010101101101011101010000
000010000010111011001111100100000
000011111110010011011110110110000
000000000000000000000000000000000
000000000000000000000000000000000
000000000000000000000000000000000
000000000000000000000000000000000
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"
$ segno -s 10 --output=private-investigations.svg 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"
$ segno --border 10 --scale 4 --output diamond.png "Shine On You Crazy Diamond"
$ segno -b 30 --scale 4 --output=boom-boom.svg Boom Boom
Colors¶
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"
Change the color of the light modules to transparent:
$ segno --light=transparent --scale 4 --output=hotel.png "Hotel California"
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"
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
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"
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"
Shortcut to specify the number of symbols:
$ segno --seq -sc 2 -s 3 -o julia.png "Half of what I say is meaningless"