Skip to main content

Optar

So...found this interesting little program called Optar the other day. It is designed to print data--at a rate of 200kB per page--to paper in a manner easily recovered into the computer. I played with it a bit this evening, and here are the results:

The payload I used was, appropriately, the contents of the Optar source directory made into a tarball (Optar pads the payload with zeroes and removes length information, and thus recommends you tar the data if this treatment is bad). Let us tar the payload and convert it:

$ tar -cf optar_test.tar *  
$ ls | grep .tar  
-rw-r--r-- 1 agmlego agmlego 614400 2008-12-23 00:55 optar_test.tar
$ optar optar_test.tar   
$ ls | grep optar_out  
-rw-r--r-- 1 agmlego agmlego 3466149 2008-12-23 00:55 optar_out_0001.pgm
-rw-r--r-- 1 agmlego agmlego 3466149 2008-12-23 00:55 optar_out_0002.pgm
-rw-r--r-- 1 agmlego agmlego 3466149 2008-12-23 00:55 optar_out_0003.pgm
-rw-r--r-- 1 agmlego agmlego 3466149 2008-12-23 00:55 optar_out_0004.pgm

Hmm...this seems to have inflated the size ::counts on fingers:: 2157%...Oh, well, on to getting these set to print:

$ pgm2ps *.pgm  
Converting optar_out_0001.pgm to optar_out_0001.ps  
Converting optar_out_0002.pgm to optar_out_0002.ps  
Converting optar_out_0003.pgm to optar_out_0003.ps  
Converting optar_out_0004.pgm to optar_out_0004.ps  
$ ls | grep ps  
-rw-r--r-- 1 agmlego agmlego 887771 2008-12-23 00:56 optar_out_0001.ps  
-rw-r--r-- 1 agmlego agmlego 887771 2008-12-23 00:56 optar_out_0002.ps  
-rw-r--r-- 1 agmlego agmlego 887771 2008-12-23 00:56 optar_out_0003.ps  
-rw-r--r-- 1 agmlego agmlego 887771 2008-12-23 00:56 optar_out_0004.ps  

Getting better--only a 478% inflation. Now to simulate scanning them in--the unoptar program only takes PNG files, so I take the PGM files into The GIMP and save them out as PNG:

$ ls | grep png  
-rw-r--r-- 1 agmlego agmlego 418899 2008-12-23 01:01 optar_out_0001.png
-rw-r--r-- 1 agmlego agmlego 383478 2008-12-23 01:03 optar_out_0002.png
-rw-r--r-- 1 agmlego agmlego 632837 2008-12-23 01:02 optar_out_0003.png
-rw-r--r-- 1 agmlego agmlego 35394 2008-12-23 01:02 optar_out_0004.png

Even better! This time, only a 139% inflation! Let us see if it converts back alright:

$ unoptar 0-65-93-24-3-1-2-24 optar_out > optar_yield.tar  
Format: text height=24  
Unformatted channel capacity 433.267 kB, formatted raw channel capacity 399.546 kB, net Golay payload capacity 199.773 kB, 133182 Golay symbols, 0 bits unused (incomplete Hamming symbol), border taking 1.50439% of unformatted capacity, border with crosses taking 7.78285% of unformatted capacity, border with crosses and Golay taking 53.8914% of unformatted capacity.  
Decoding PNG file optar_out_0001.png...  
Input 1546 x 2242 pixels, taking 6.93226 megabytes for 2 framebuffers.  
Average pixel value 147  
Black 0, white 255, cutlevel 26 (0x1a), fill cutlevel 128 (0x80)  
Black 0, white 255, cutlevel 26 (0x1a), fill cutlevel 128 (0x80)  
Removing dirt from the white border: white border identified, data area identified, erased 0 pixels of dirt.  
Searching for the corners.  
One bit is 1 horizontal pixels and 1 vertical pixels.  
Input horizontal pixel vector 1,0, vertical 0,1. skew 0 deg, perpendicularity 90 deg.  
Allocating search area of 2 x 2 (4) pixels.  
Upper corners at 0, 0 and 1546, 0,  
lower corners at 0, 2242 and 1546, 2242.  
Cross half for searching is 1 x 1 input pixels.  
Finding crosses (93 lines), numbers indicate individual cutlevels:  
0: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f   
[massive snip]  
92: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f   
No bad bits!  
Golay stats  
===========  
0 bad bits 133182  
1 bad bit 0  
2 bad bits 0  
3 bad bits 0  
4 bad bits 0  
total codewords 133182  
Writing debug image into optar_out_0001_debug.pgm.  
Decoding PNG file optar_out_0002.png...  
Input 1546 x 2242 pixels, taking 6.93226 megabytes for 2 framebuffers.  
Average pixel value 177  
Black 0, white 255, cutlevel 26 (0x1a), fill cutlevel 128 (0x80)  
Black 0, white 255, cutlevel 26 (0x1a), fill cutlevel 128 (0x80)  
Removing dirt from the white border: white border identified, data area identified, erased 0 pixels of dirt.  
Searching for the corners.  
One bit is 1 horizontal pixels and 1 vertical pixels.  
Input horizontal pixel vector 1,0, vertical 0,1. skew 0 deg, perpendicularity 90 deg.  
Allocating search area of 2 x 2 (4) pixels.  
Upper corners at 0, 0 and 1546, 0,  
lower corners at 0, 2242 and 1546, 2242.  
Cross half for searching is 1 x 1 input pixels.  
Finding crosses (93 lines), numbers indicate individual cutlevels:  
0: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f   
[massive snip]  
92: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f   
No bad bits!  
Golay stats  
===========  
0 bad bits 133182  
1 bad bit 0  
2 bad bits 0  
3 bad bits 0  
4 bad bits 0  
total codewords 133182  
Writing debug image into optar_out_0002_debug.pgm.  
Decoding PNG file optar_out_0003.png...  
Input 1546 x 2242 pixels, taking 6.93226 megabytes for 2 framebuffers.  
Average pixel value 148  
Black 0, white 255, cutlevel 26 (0x1a), fill cutlevel 128 (0x80)  
Black 0, white 255, cutlevel 26 (0x1a), fill cutlevel 128 (0x80)  
Removing dirt from the white border: white border identified, data area identified, erased 0 pixels of dirt.  
Searching for the corners.  
One bit is 1 horizontal pixels and 1 vertical pixels.  
Input horizontal pixel vector 1,0, vertical 0,1. skew 0 deg, perpendicularity 90 deg.  
Allocating search area of 2 x 2 (4) pixels.  
Upper corners at 0, 0 and 1546, 0,  
lower corners at 0, 2242 and 1546, 2242.  
Cross half for searching is 1 x 1 input pixels.  
Finding crosses (93 lines), numbers indicate individual cutlevels:  
0: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f   
[massive snip]  
92: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f  
No bad bits!  
Golay stats  
===========  
0 bad bits 133182  
1 bad bit 0  
2 bad bits 0  
3 bad bits 0  
4 bad bits 0  
total codewords 133182  
Writing debug image into optar_out_0003_debug.pgm.  
Decoding PNG file optar_out_0004.png...  
Input 1546 x 2242 pixels, taking 6.93226 megabytes for 2 framebuffers.  
Average pixel value 241  
Black 0, white 255, cutlevel 26 (0x1a), fill cutlevel 128 (0x80)  
Black 0, white 255, cutlevel 26 (0x1a), fill cutlevel 128 (0x80)  
Removing dirt from the white border: white border identified, data area identified, erased 0 pixels of dirt.  
Searching for the corners.  
One bit is 1 horizontal pixels and 1 vertical pixels.  
Input horizontal pixel vector 1,0, vertical 0,1. skew 0 deg, perpendicularity 90 deg.  
Allocating search area of 2 x 2 (4) pixels.  
Upper corners at 0, 0 and 1546, 0,  
lower corners at 0, 2242 and 1546, 2242.  
Cross half for searching is 1 x 1 input pixels.  
Finding crosses (93 lines), numbers indicate individual cutlevels:  
0: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f   
[massive snip]  
92: 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f 0f  
No bad bits!  
Golay stats  
===========  
0 bad bits 133182  
1 bad bit 0  
2 bad bits 0  
3 bad bits 0  
4 bad bits 0  
total codewords 133182  
Writing debug image into optar_out_0004_debug.pgm.  
$ ls | grep .tar  
-rw-r--r-- 1 agmlego agmlego 614400 2008-12-23 00:55 optar_test.tar
-rw-r--r-- 1 agmlego agmlego 799092 2008-12-23 01:03 optar_yield.tar

Four good files (not surprisingly, as this was a vacuous test, but Optar should handle some damage and dirt on the input pages), a valid tarball created, and in the end, only a 30% filesize increase. Not effective for compressing data, but neither is it supposed to do so. Rather, it is intended as a way to transmit data via paper ina machine-readable format, perhaps to bolster the data throughput for RFC 1149...