This command line tool (multiplatform, written in python3) can be used to backup/restore small files (at least 7000..17000 Byte per sheet of A4 paper) to/from paper using QR codes. It

  • splits a file into parts, creates a graphic containing one or more QR codes and some description

  • reassembles files taken from QR codes to obtain the original file

In contrast to just splitting the file (like done here and here) it includes extra information to ease reassembling. In contrast to the second link it does not enforce you to use tex or zbar.

It only depends on python3, ImageMagick and qrencode which are available on every recent linux distribution and for windows.

A smartphone with a QR code scanner like Binary Eye and a PC able to run python3 scripts is sufficient to restore the original file from paper. Using zbar is optional.

Creating the backup

To backup a file called passwords.kdbx call

python3 backup passwords.kdbx

and a picture file called passwords.kdbx.png (or several numbered ones passwords.kdbx-NUMBER.png in case of a bigger file) will be generated. Print them out on paper.

You can adjust error correction level, number of QR codes per page, additional text on every page, and more. See python3 --help.

Restoring the backup

Scanning one code at a time

Decode every QR code to one file.

If your smartphone scanner fails on a code, try zooming in (digital zoom) — reducing the real pixel count seemed to help in my tests.


python3 restore file1 file2 file3 ...

Names and order of files does not matter. The output file will be named like original input file if not overridden by --output.

Using zbar on a whole pages of codes

zbarimg (at least version >= 0.23.90) is able to decode all those QR codes at once, but I don’t really like its output. This feature is not implemented yet.

Use zbarimg --raw -q -Sbinary.

Latest modification: 26.05.2021 05:52
Jens W. Wulf