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
Create a static HTML/CSS image gallery from a bunch of images.

gallerize Create a static HTML/CSS image gallery from a bunch of images.

Jochen Kupperschmidt 19 Aug 21, 2022
The 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 Dec 30, 2022
PSD (Photoshop, Krita, Gimp...) -> Godot.

limage v0.2.2 Features Getting Started Tags Settings Todo Customizer Changes Solutions WARNING: Requires Python to be installed PSD (Photoshop, Krita,

21 Nov 10, 2022
Python scripts for semi-automated morphometric analysis of atolls from Landsat satellite Imagery.

AtollGeoMorph Python scripts for semi-automated morphometric analysis of atolls from Landsat satellite Imagery. The python scripts included allow user

1 Dec 16, 2022
Simple Python image processing & automatization project for a simple web based game

What is this? Simple Python image processing & automatization project for a simple web based game Made using only Github Copilot (except the color and

SGeri 2 Aug 15, 2022
Python Program that lets you write in your handwriting!

Handwriting with Python Python Program that lets you write in your handwriting! Inspired by: thaisribeiro.in How to run? Install Unidecode and Pillow

Amanda Rodrigues Vieira 2 Oct 25, 2021
A functional and efficient python implementation of the 3D version of Maxwell's equations

py-maxwell-fdfd Solving Maxwell's equations via A python implementation of the 3D curl-curl E-field equations. This code contains additional work to e

Nathan Zhao 12 Dec 11, 2022
Forza painter app with python

forza-painter Discord: A-Dawg#0001 (AE) Supports: Forza Horizon 5 Offically (OTHER v1.405.2.0, MS STORE v3.414.967.0, STEAM v1.414.967.0) Unofficially

320 Dec 31, 2022
Extract the ISO 11146 beam size from an image file

laserbeamsize Simple and fast calculation of beam sizes from a single monochrome image based on the ISO 11146 method of variances. Some effort has bee

Scott Prahl 21 Jan 06, 2023
Magic-Square - Creates a magic square by randomly generating a list until the list happens to be a magic square

Magic-Square Creates a magic square by randomly generating a list until the list happens to be a magic square. Done as simply as possible... Frequentl

Nick 2 Jan 01, 2022
Automatic picture transmission(APT) protocol decoder for NOAA weather satellites

Automatic picture transmission(APT) decoder Automatic picture transmission protocol is used by NOAA satellites. They constantly send a frequency modul

Jayachandra Kasarla 25 Aug 05, 2022
Tweet2Image - Convert tweets to Instagram-friendly images.

Convert tweets to Instagram-friendly images. How to use If you want to use this repository as a submodule, don't forget to put the fonts d

Janu Lingeswaran 1 Mar 11, 2022
Gallery written in Python to manage your photos

GalleryMan Gallery written in Python to manage your photos Installation

Asian Cat 24 Dec 18, 2022
starfish is a Python library for processing images of image-based spatial transcriptomics.

starfish: scalable pipelines for image-based transcriptomics starfish is a Python library for processing images of image-based spatial transcriptomics

199 Dec 08, 2022
View images in the terminal using ansi escape codes and python

terminal-photo-viewer view images in the terminal using ansi escape codes and python !! Only tested on Ubuntu 20.04.3 LTS with python version 3.8.10 D

1 Nov 30, 2021
Repair broken bookmarks to referenced files in Apple Photos

Repair Apple Photos Bookmarks Work in progress to repair file location bookmarks in Apple Photos. Background Starting in macOS 10.15/Catalina, photos

Rhet Turnbull 10 Nov 03, 2022
SGTL - Spectral Graph Theory Library

SGTL - Spectral Graph Theory Library SGTL is a python library of spectral graph theory methods. The library is still very new and so there are many fe

Peter Macgregor 6 Oct 01, 2022
Png2Jpg tool will help you convert from png image format to jpg images format.

PNG 2 JPG All codes assume running from root directory. Please update the sys path at the beginning of the codes before running. Over View Png2Jpg too

Nguyễn Trường Lâu 2 Dec 27, 2021
Glyph-graph - A simple, yet versatile, package for graphing equations on a 2-dimensional text canvas

Glyth Graph Revision for 0.01 A simple, yet versatile, package for graphing equations on a 2-dimensional text canvas List of contents: Brief Introduct

Ivan 2 Oct 21, 2022
PyLibTiff - a wrapper to the libtiff library to Python using ctypes

PyLibTiff is a package that provides: a wrapper to the libtiff library to Python using ctypes. a pure Python module for reading and writing TIFF and L

Pearu Peterson 105 Dec 21, 2022