Paper backup of files using QR codes

Overview

Generate paper backups for Linux. Currently command-linux Linux only.

Takes any file, and outputs a "paper backup": a printable black-and-white pdf full of QR codes. To back up your file, print the PDF. The pile of paper in your hand is now a backup of the file.

This is alpha software--I use it for my own backups, but I offer no guarantees. Test your restore when you make it, not when you need it!

What is a paper backup?

A paper backup is a number of printed sheets of paper containing special barcodes.

If your file is lost, corrupted, deleted, etc, you can restore from your paper backup. qr-backup reads the QR barcodes using your computer's webcam (or scanner) to get your file back.

Should I back up to paper?

Possibly. You should still back it up to something more usual like a USB thumbstick first, because it's easier to restore and update.

Common files to back up are small important records, and small secret files. Examples include: a diary, an address book, a short story you wrote, financial records, medical records, an ssh or gpg cryptographic key, or a cryptocurrency (bitcoin) wallet.

Paper is not the best or most efficient storage method, so you can't back up big files. 10KB or 100KB files is a reasonable limit.

Learn about the advantages of paper backups.

Example Backup

Example Backup

System Requirements

Backup Requirements

  • A Linux computer and knowledge of how to use the command line
  • A printer
  • python 3.6 or later
  • python-qrcode
  • python-pillow
  • imagemagick
  • zbar (optional, used to digitally test restore)

Restore Requirements

  • A Linux computer and knowledge of how to use the command line
  • The restore process works without qr-backup installed
  • A webcam or scanner
  • imagemagick
  • zbar

Making a backup

  1. Run qr-backup on your file. On the Linux command-line, run qr-backup
  2. This generates a black-and-white PDF (.qr.pdf)
  3. Print the PDF on your printer

There are many command-line options available for advanced users. For a full list, read the USAGE doc online, or run qr-backup --help on your computer.

Restoring a paper backup

The restore process does NOT require qr-backup. It does require a command-linux Linux computer.

(Option 1): Use qr-backup, if you have it.

  • Webcam option
    1. Run qr-backup --restore
  • Scanner option
    1. Scan images using your scanner
    2. Run qr-backup --restore IMAGES

(Option 2): Use the linux command line, if you lose qr-backup. Commands are provided in the PDF printout. You will need to install zbar.

More questions

For more questions, see the FAQ.

Comments
  • Investigate par2 format for parity

    Investigate par2 format for parity

    I've been working on this on my own implementation.

    There's an easy solution that already exists. Par2 is a recovery file which generates Reed Solomon codes. It's a packetized format, so you can zero pad each packet to fit in a QR code and the programs will still read them.

    The downside is that you need to be aware that recovery packets are 64 bytes larger compared to the recovery block size.

    If you don't care about exact alignment, you can just use Par2 as is. If you do, I am currently working on Par2Py, which will allow for alignment and for using an optional packet type that stores the data itself inside the Par2 file itself.

    The advantage of this approach is if you do one Par2 packet per QR code, then not only can you recover from some codes missing, but you can also recover from codes being scrambled!

    Originally posted by @EmperorArthur in https://github.com/za3k/qr-backup/issues/2#issuecomment-890360305

    enhancement question 
    opened by za3k 19
  • (meta) Adjusting the settings to obtain a higher storage density

    (meta) Adjusting the settings to obtain a higher storage density

    I wanted to open this issue as a more open-ended alternative to the pull request I made (#25). I definitely think that a higher storage density (on paper) can be achieved than the defaults currently provide, which would save paper and storage space.

    Version 40 does not appear to work to any reasonable degress when printed. However, after doing some experimentation, I have found that QR version 25 with error correction level "H" can be used to fit a 4x3 grid of codes onto a page which, when printed, can be scanned reliably by both my phone (which is a mid-range Android from 2018) and a scanner, and can reliably reproduce a valid backup without any issue.

    Please give it a try and let me know what you think.

    enhancement 
    opened by arcanemachine 10
  • Add option to print human-readable information to stdout

    Add option to print human-readable information to stdout

    This is just a small modification that enables the QR code data to be printed to stdout by using the --human-readable-stdout flag, so that it can, for example, be piped to a text file and printed off.

    It's not pretty, but it easily and effectively adds an important layer of redundancy. In case 1 or more QR codes becomes corrupted, the data can still be recovered by manual entry.

    The flag itself was chosen so that it doesn't collide with a more well-integrated --human-readable flag that would presumably be added to the document using Pillow.

    opened by arcanemachine 9
  • Allow restore with some QR codes missing or damaged (parity)

    Allow restore with some QR codes missing or damaged (parity)

    This would essentially require qr-backup --restore... there's no easy command-line programs to do this. Try to make it restorable without qr-backup if there's no damage.

    Edit: could also support shamir's secret sharing scheme

    enhancement help wanted 
    opened by za3k 7
  • Webcam restore blocks CLI prompts

    Webcam restore blocks CLI prompts

    Screenshot of the problem is requested--author uses a tiling window manager and didn't think about this.

    Do people find the preview useful? It can just be turned off entirely.

    enhancement good first issue 
    opened by za3k 4
  • All versions of Pillow > 8.2.0 create a PDF that doesn't work in most PDF readers I tried.

    All versions of Pillow > 8.2.0 create a PDF that doesn't work in most PDF readers I tried.

    EDIT: Using Pillow 8.2.0 generates uncorrupted PDFs.

    Hello, this program is generating broken PDFs that do not display in any PDF view that I have tried, with the exception of Chrome.

    In Linux, the PDF fails to open in Evince, Firefox, and Libreoffice Draw (this one crashes).

    On Adroid, the PDF works in an old Google PDF reader app that I use, but fails in Moon Reader.

    In all apps that display the PDF without crashing, the PDF looks the same: like a noisy, streaky mess.

    I am using Xubuntu 21.04 x64.

    I have tried a couple different files with the same result. To show my issues, I have attempted to create a backup of CHANGELOG from the latest commit (currently 926355d85ddd3fb8878da07e5cf464d47fb14569).

    Here is a link to the PDF generated: https://filelink.org/kRWFohOf6Lur0RZ Here is an image of how it looks on my computer (on anything other than Chromium) and on Android Moon Reader: https://ibb.co/6J9XGJC

    Here are the versions I have installed (via pip freeze from a venv):

    Pillow==9.0.1
    qrcode==7.3.1
    

    Here is my terminal output from when I created the file:

    (venv) [email protected]:~/code/git/qr-backup$ ./qr-backup CHANGELOG -v
    INFO:root:Original arguments were: []
    INFO:root:Command arguments parsed. Equivalent command: qr-backup --qr-version 10 --dpi 300 --scale 8 --error-correction L --page 500 600 --compress --filename CHANGELOG
    INFO:root:read file CHANGELOG (sha b8d63ca5584ffa66aea55851e6fb9f60b5a10542086a95cfba2b5cd6479870a4, 2.731KB)
    INFO:root:Restore command is: sort -u | grep "^N" | cut -c6- | base64 -d | gunzip
    INFO:root:9 qr codes (at version 10) total
    INFO:root:QR code (including label) is: 520x520px
    INFO:root:Page is: 2083x2500px
    INFO:root:4 x 4 qr codes (at version 10) per page. 1 pages total
    INFO:root:1326 bytes in 1 (2.73KB/page)
    WARNING:root:Skipping digital restore verification, because zbarimg is not available.
    
    bug 
    opened by arcanemachine 3
  • Use QR version 40 to increase amount of data per page

    Use QR version 40 to increase amount of data per page

    The default QR code version used (version 10) results in the creation of many QR codes. This requires many more scans (and thus, much more effort) than the the highest-density QR code version 40. Furthermore, version 40 codes have higher information density over a given area that version 10, meaning their usage will save both time and paper.

    Therefore, this simple pull request is to change the default QR code version from 10 to 40.

    opened by arcanemachine 2
  • Add `--human-readable` mode

    Add `--human-readable` mode

    Add a human-readable mode, in which the original file is printed along with the QR codes (the same data on the page should match the data in the QR codes). One row of QR codes per page max seems reasonable.

    enhancement 
    opened by za3k 2
  • base64 encoding always turned on

    base64 encoding always turned on

    In the FAQ, it says: "Make sure your document doesn't contain weird characters (including "\r", the mac/windows newline), or base64 encoding will turn on, which makes recovery harder."

    However, it seems there's no conditional use of base64 encoding in the code, and alpha strings are always encoded:

    $ echo -n ipsum > ipsum.txt
    $ qr-backup --no-compress -o ipsum.pdf ipsum.txt
    $ zbarimg ipsum.pdf 
    QR-Code:N1/1 aXBzdW0=
    scanned 1 barcode symbols from 1 images in 0,04 seconds
    
    documentation 
    opened by misaki-web 1
  • Add a 'text-backup' tool

    Add a 'text-backup' tool

    Add a separate command line tool text-backup which generates a text-mode backup instead of using QR. It should be keyed back in by hand.

    Ideas:

    • Include checksums and ECC per-line
    • Can we make it "readable" if the original is text, so that you don't have to key in some text to read other text?
    • Try to make it easy to type? BIP39 wordlist, PGP word list, etc may be a good option but then need the wordlist to decode.
    • Generate .txt by default with a .pdf option

    This will require factoring out the "QR" backup, restore, and test process from the rest of the logic. Could be done before or after adding erasure coding.

    enhancement good first issue 
    opened by za3k 1
  • Add erasure coding. This allows losing some QR codes

    Add erasure coding. This allows losing some QR codes

    IMPORTANT: This doesn't work currently. There seems to be a bug in the reedsolo library. It has been reported at https://github.com/tomerfiliba/reedsolomon/issues/34

    This required removing the proprocessing step of base64 encoding. Instead, we base64 encode each QR code independently (always). Sadly this does make the data a little less readable while debugging. Closes #2.

    opened by za3k 1
  • Webcam restore -- unshuffle

    Webcam restore -- unshuffle

    During webcam restore, missing codes are listed as "N1", "N2" etc.

    It might be reasonable to un-shuffle using prng and hint at position?

    enhancement 
    opened by za3k 0
  • Roadmap

    Roadmap

    • [x] v1.0: Initial release
    • [x] v1.1: Feature complete
    • [ ] release: Ship in any easy-to-install format
    • [ ] v1.2: Support for Windows, Mac, and Android. Add GUI.
    documentation 
    opened by za3k 1
  • Make page layout look better

    Make page layout look better

    Currently, the argument --page allows to set the width and the height (--page 500 600), but the page margins can't be specified. For example, cover instructions basically don't have any margin:

    default margin

    It would be useful to be able to set horizontal and vertical margins like this:

    --page WIDTH_POINTS+HOR_MARGIN_POINTS HEIGHT_POINTS+VER_MARGIN_POINTS
    

    Example:

    --page 500+15 600+15
    

    more margin

    It would also allow to center the QR codes on the page.

    enhancement 
    opened by misaki-web 2
Releases(v1.1.3)
  • v1.1.3(Oct 15, 2022)

    Generate paper backups for Linux. Currently command-line Linux only.

    qr-backup takes file(s), and outputs a "paper backup": a printable black-and-white pdf full of QR codes. To back up your file, print the PDF. The pile of paper in your hand is now a backup of the file.

    If your file is lost, corrupted, deleted, etc, you can restore from your paper backup. qr-backup reads the QR barcodes using your computer's webcam (or scanner) to get your file back.


    Major new features:

    v1.1.3

    • bash completion
    • add experimental debian package build scripts to Makefile

    v1.1.2

    • qr-backup is ready for packaging

    v1.1

    • Add --restore option, which automatically does a restore in qr-backup itself. Previously restore was done with a bash oneliner only (which still works). Note that --restore cannot restore backups made with v1.0.
    • An automatic digital restore check is done after every backup.
    • Allow restore (using qr-backup only) even if up to 30% of barcodes are missing. Uses reed-solomon erasure codes.
    • Improved data density, but this roughly cancels out with increased size from erasure coding.
    • Optional password protection (encryption).
    • Support backing up a directory. Support backing up multiple files or directories
    • Support printing multiple copies of each barcode
    • Customize printed documentation (less, more, custom notes)

    View CHANGELOG for all details.

    Source code(tar.gz)
    Source code(zip)
    qr-backup-1.1.3.tar.gz(470.45 KB)
    qr-backup-1.1.3.tar.gz.sig(833 bytes)
    qr-backup_1.1.3-1_all.deb(31.82 KB)
  • v1.1.2(Sep 30, 2022)

    Generate paper backups for Linux. Currently command-line Linux only.

    qr-backup takes file(s), and outputs a "paper backup": a printable black-and-white pdf full of QR codes. To back up your file, print the PDF. The pile of paper in your hand is now a backup of the file.

    If your file is lost, corrupted, deleted, etc, you can restore from your paper backup. qr-backup reads the QR barcodes using your computer's webcam (or scanner) to get your file back.


    Major new features:

    v1.1.2

    • qr-backup is ready for packaging

    v1.1

    • Add --restore option, which automatically does a restore in qr-backup itself. Previously restore was done with a bash oneliner only (which still works). Note that --restore cannot restore backups made with v1.0.
    • An automatic digital restore check is done after every backup.
    • Allow restore (using qr-backup only) even if up to 30% of barcodes are missing. Uses reed-solomon erasure codes.
    • Improved data density, but this roughly cancels out with increased size from erasure coding.
    • Optional password protection (encryption).
    • Support backing up a directory. Support backing up multiple files or directories
    • Support printing multiple copies of each barcode
    • Customize printed documentation (less, more, custom notes)

    View CHANGELOG for all details.

    Source code(tar.gz)
    Source code(zip)
  • v1.0(Jun 1, 2021)

Owner
Zachary Vance
Zachary Vance
Python wrappers for external BART computational imaging tools and internal libraries

bartpy Python bindings for BART. Overview This repo contains code to generate an updated Python wrapper for the Berkeley Advance Reconstruction Toolbo

Max Litster 7 May 09, 2022
Multiparametric Image Analysis

Documentation The documentation is available on populse_mia's website here Installation From PyPI, for users By cloning the package, for developers Fr

Populse 9 Dec 14, 2022
a lite weight photo editor written in python for day to day photo editing!

GNU-PhotoShop A lite weight Photo editing Program (currently CLI only) written in python3 for day to day photo editing. Disclaimer : Currently we don'

Kunal Sharma 5 May 30, 2022
A Python package implementing various CFA (Colour Filter Array) demosaicing algorithms and related utilities.

Colour - Demosaicing A Python package implementing various CFA (Colour Filter Array) demosaicing algorithms and related utilities. It is open source a

colour-science 218 Dec 04, 2022
📷 Python package and CLI utility to create photo mosaics.

📷 Python package and CLI utility to create photo mosaics.

Loic Coyle 7 Oct 29, 2022
A simple plugin to view APR images in napari

napari-apr-viewer A simple plugin to view APR images in napari This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-

5 Jan 24, 2022
Computer art based on joining transparent images

Computer Art There is no must in art because art is free. Introduction The following tutorial exaplains how to generate computer art based on a series

Computer Art 12 Jul 30, 2022
Seeks to remove text from an image in a convincing way.

Text-Removal This is a Computer Vision project that seeks to successfully remove text from an image by covering the text areas in a convincing way. He

6 Nov 22, 2022
Group of interfaces interesting for users

Project: Interface to create GIF animation based on Fourier Series.

5 Aug 17, 2021
TRREASURE_IMAGE is python lib by which you can hide anything in a .jpg image with Command-Line Interface[cli] feature

TRREASURE_IMAGE TRREASURE_IMAGE is a python third-party library with Command-Line Interface[cli] feature. Table of Contents General Info Python librar

Fatin Shadab 3 Jun 07, 2022
A Python Script to convert Normal PNG Image to Apple iDOT PNG Image.

idot-png-encoder A Python Script to convert Normal PNG Image to Apple iDOT PNG Image (Multi-threaded Decoding PNG). Usage idotpngencoder.py -i inputf

Lrdcq 2 Feb 17, 2022
Wand is a ctypes-based simple ImageMagick binding for Python

Wand Wand is a ctypes-based simple ImageMagick binding for Python, supporting 2.7, 3.3+, and PyPy. All functionalities of MagickWand API are implement

Eric McConville 1.2k Jan 03, 2023
python binding for libvips using cffi

README PyPI package: https://pypi.python.org/pypi/pyvips conda package: https://anaconda.org/conda-forge/pyvips We have formatted docs online here: ht

libvips 467 Dec 30, 2022
QR Code Generator

In this project, we'll be using some libraries to instantly generate authentic QR Codes and export them in various formats

Hassan Shahzad 3 Jun 02, 2022
Python Digital Art Generator

Python Digital Art Generator The main goal of this repository is to generate all possible layers permutations given by the user in order to get unique

David Cuentas Mar 3 Mar 12, 2022
Python implementation of image filters (such as brightness, contrast, saturation, etc.)

PyPhotoshop Python implementation of image filters Use Python to adjust brightness and contrast, add blur, and detect edges! Follow along tutorial: ht

Kylie 87 Dec 15, 2022
Maze generator with most popular shapes - hexagon, triangle, square

Maze-Generator Maze generator with most popular shapes - hexagon, triangle, square (sqaure not implemented yet): Theory: Planar Graph https://en.wikip

Kacper Plesiak 2 Dec 28, 2021
An python script to convert images to upscaled versions made out of one-colour emojis.

ABOUT This is an python script to convert png, jpg and gif(output isnt animated :( ) images to scaled versions made out of one-colour emojis. Please n

0 Oct 19, 2022
Tools for making image cutouts from sets of TESS full frame images

Cutout tools for astronomical images Astrocut provides tools for making cutouts from sets of astronomical images with shared footprints. It is under a

Space Telescope Science Institute 20 Dec 16, 2022
Convert HDR photos taken by iPhone 12 (or later) to regular HDR images

heif-hdrgainmap-decode Convert HDR photos taken by iPhone 12 (or later) to regular HDR images. Installation First, make sure you have the following pa

Star Brilliant 5 Nov 13, 2022