Ronja Twibright Labs

Twibright Optar

Cutout from the Optar recording

What is Optar

Optar stands for OPTical ARchiver. It's a codec for encoding data on paper or free software 2D barcode in other words. Optar fits 200kB on an A4 page, then you print it with a laser printer. If you want to read the recording, scan it with a scanner and feed into the decoder program. A practical level of reliability is ensured using forward error correction code (FEC). Automated processing of page batches facilitates storage of files larger than 200kB.


optar.tgz - unpack this source code and see README for instructions. Contains encoder optar and decoder unoptar. Works with PGM (Portable GrayMap) uncompressed picture format.


If you wish to change the resolution - for example half the resultion, 1/4 data or 50 kB per page - edit optar.h and change

#define XCROSSES 65 /* Number of crosses horizontally */
#define YCROSSES 93 /* Number of crosses vertically */

to approximately a half:

#define XCROSSES 32 /* Number of crosses horizontally */
#define YCROSSES 46 /* Number of crosses vertically */

Then do "make clean" and compile and install Optar again. You can reduce or increase these numbers according to the overall resolution of your printer and scanner combination.


Optar recording closeup

I tried ordinary office paper, laser printer hp LaserJet 2200dtn and scanner CanoScan N650U at 1200dpi weighted with yellow pages. The data density was default 200kB per page. I folded the paper twice, put it into my pocket, pulled out and scanned. Quality of the acquired image can be seen on the right. Resulting Golay statistics show very high reliability:

Bad bitsCount [Golay codewords]

Extrapolation estimate of the probability in the last row (1/(386*(386/132814)^3)) suggests that one Golay symbol with 4 bad bits, which means data damage, occurs once in 105,531 (hundred thousand...) pages.

Possible uses

Data storage


Media augmentation

Data transmission


How it works

Optar recording closeup

The printer, although having 600dpi nominal resolution, cannot reliably print individual white and black dots with 600dpi. The practical limit is at 200dpi, i. e. 3x3 pixel squares. That corresponds to 200kB per page when taking overhead into account.


The Golay code

Postscript / PDF / EPS / BIG png / SVG (Inkscape)

To make sure the Golay code is not programmed with a mistake, I first needed to understand it. Starting with a predefined table of zeroes and ones doesn't count as understanding so I found an article (now a book without free text) called Decoding the Golay code by hand, which describes the principle of Golay code in an easy to remember way.

According to this article, Golay code consists of 12 data bits and 12 parity bits. First the data bits are painted on a dodecahedron (12 faces). Then a paper mask of 5 faces into a circle with a hole in the middle is applied with the hole on each of the face. All visible bits are XORed together and written as parity symbol for that nth position. The the data word and parity word are concatenated. This creates 4096 Golay words. Each two 24 bit Golay words differ in at least 8 bits. Therefore if up to 3 bits are altered, we still know for sure the original code word.

The decoding is implemented in Twibright Optar in a primitive way. A table of words is scanned until a match with up to 3 different bits is found. If no match is found, then the Golay word must be irreparably damaged. It's possible to decode faster, it's just not implemented.

Possible future improvement


  • Paperback, a similar free software for the Windows platform
  • An expected information missing here?