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
Samila is a generative art generator written in Python

Samila is a generative art generator written in Python, Samila let's you create arts based on many thousand points. The position of every single point is calculated by a formula, which has random par

Sepand Haghighi 947 Dec 30, 2022
Python modules to work with large multiresolution images.

Large Image Python modules to work with large, multiresolution images. Large Image is developed and maintained by the Data & Analytics group at Kitwar

Girder 136 Jan 02, 2023
AutoGiphyMovie lets you search giphy for gifs, converts them to videos, attach a soundtrack and stitches it all together into a movie!

AutoGiphyMovie lets you search giphy for gifs, converts them to videos, attach a soundtrack and stitches it all together into a movie!

Satya Mohapatra 18 Nov 13, 2022
Python framework for creating and scaling up production of vector graphics assets.

Board Game Factory Contributors are welcome here! See the end of readme. This is a vector-graphics framework intended for creating and scaling up prod

Adam Volný 5 Jul 13, 2022
A procedural Blender pipeline for photorealistic training image generation

BlenderProc2 A procedural Blender pipeline for photorealistic rendering. Documentation | Tutorials | Examples | ArXiv paper | Workshop paper Features

DLR-RM 1.8k Jan 02, 2023
ProsePainter combines direct digital painting with real-time guided machine-learning based image optimization.

ProsePainter Create images by painting with words. ProsePainter combines direct digital painting with real-time guided machine-learning based image op

Morphogen 276 Dec 17, 2022
Extracts dominating colors from an image and presents them as a palette.

ColorPalette A simple web app to extract dominant colors from an image. Demo Live View it live at : https://colorpalettedemo.herokuapp.com/ You can de

Mayank Nader 214 Dec 29, 2022
Qrgenerator - A qr generator app using python3

qrgenerator by Mal4D Hi welcome into qr code generator using python by Mal4d Lin

Mal4D 1 Jan 09, 2022
An agnostic Canvas API for the browser-less and insane

Apollo An agnostic Canvas API for the browser-less and mildly insane. Project Apollo is a Pythonic re-imagining of HTML Canvas element implementati

1 Jan 13, 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
Panel Competition Image Generator

Panel Competition Image Generator This project was build by a member of the NFH community and is open for everyone who wants to try it. Relevant links

Juliano Mendieta 1 Oct 22, 2021
Python QR Code image generator

Pure python QR Code generator Generate QR codes. For a standard install (which will include pillow for generating images), run: pip install qrcode[pil

Lincoln Loop 3.5k Dec 31, 2022
A script to generate a profile picture and a banner that show the same image on Discord.

Discord profile picture & banner generator A script to generate a profile picture and a banner that show the same image on Discord. Installation / Upd

Victor B. 9 Nov 27, 2022
LabelMe annotation tool source code

LabelMe annotation tool source code Here you will find the source code to install the LabelMe annotation tool on your server. LabelMe is an annotation

MIT CSAIL Computer Vision 1.3k Jan 03, 2023
Dynamic image server for web and print

Quru Image Server - dynamic imaging for web and print QIS is a high performance web server for creating and delivering dynamic images. It is ideal for

Quru 84 Jan 03, 2023
The friendly PIL fork (Python Imaging Library)

Pillow Python Imaging Library (Fork) Pillow is the friendly PIL fork by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lund

Pillow 10.4k Dec 31, 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
Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

Anaglyph 3D Converter - A python script that adds a 3D anaglyph style effect to an image using the Pillow image processing package.

Kizdude 2 Jan 22, 2022
A minimal, standalone viewer for 3D animations stored as stop-motion sequences of individual .obj mesh files.

ObjSequenceViewer V0.5 A minimal, standalone viewer for 3D animations stored as stop-motion sequences of individual .obj mesh files. Installation: pip

csmailis 2 Aug 04, 2022
SALaD (Semi-Automatic Landslide Detection) is a landslide mapping system

SALaD (Semi-Automatic Landslide Detection) is a landslide mapping system. SALaD utilizes Object-based Image Analysis and Random Forest to map landslides.

NASA 14 Jan 04, 2023