mirror of
https://github.com/colindean/optar.git
synced 2025-03-11 22:17:40 +13:00
Compare commits
17 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
03282c425b | ||
|
c3d48030db | ||
|
45750f333a | ||
|
5b72af0eb2 | ||
|
59da44cbed | ||
|
ca2ae12337 | ||
|
1d0b87c6c5 | ||
|
2a6de7550f | ||
|
b3270e4537 | ||
|
3956bd04a6 | ||
|
7b80324f76 | ||
|
e7b7d26bfa | ||
|
a3266f26ea | ||
|
4bbe161c8a | ||
|
1bed801fe7 | ||
|
a36cf13e52 | ||
|
94badc9693 |
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
*.o
|
||||||
|
golay
|
||||||
|
golay_codes.c
|
||||||
|
optar
|
||||||
|
unoptar
|
24
.travis.yml
24
.travis.yml
@ -1,5 +1,21 @@
|
|||||||
language: c
|
language: c
|
||||||
compiler:
|
|
||||||
- clang
|
matrix:
|
||||||
- gcc
|
include:
|
||||||
script: "make"
|
- os: linux
|
||||||
|
compiler: gcc
|
||||||
|
- os: osx
|
||||||
|
compiler: clang
|
||||||
|
|
||||||
|
script: make -j
|
||||||
|
before_deploy: make -j archive
|
||||||
|
deploy:
|
||||||
|
provider: releases
|
||||||
|
api_key:
|
||||||
|
secure: mz4/p8VB7qn6F3M8uPT2/mJmU/nEWRGgsxN+KM/Gg1isSVrRpWP0xYfPTOdU6o9f0IVBRIW7SjHuq1H9kqGhmWx+Aycs8gE905ORYidLRjbkPN/fiS2jL6CcRzolkprvK7btIRhxfFGB/y3L0MELh+kXo1A6oIm+2a+OwNpdi4c=
|
||||||
|
file: optar-*.tar.gz
|
||||||
|
file_glob: true
|
||||||
|
skip_cleanup: true
|
||||||
|
on:
|
||||||
|
repo: colindean/optar
|
||||||
|
tags: true
|
||||||
|
37
Makefile
37
Makefile
@ -5,10 +5,25 @@ ifeq ($(CC), gcc)
|
|||||||
else
|
else
|
||||||
SPECIFIC_CFLAGS=
|
SPECIFIC_CFLAGS=
|
||||||
endif
|
endif
|
||||||
|
INCLUDE_PATHS=$(shell libpng-config --I_opts)
|
||||||
CFLAGS=-O3 -Wall -Wuninitialized \
|
CFLAGS=-O3 -Wall -Wuninitialized \
|
||||||
-fomit-frame-pointer -funroll-loops \
|
-fomit-frame-pointer -funroll-loops \
|
||||||
$(SPECIFIC_CFLAGS) \
|
$(SPECIFIC_CFLAGS) \
|
||||||
-DNODEBUG `libpng-config --I_opts`
|
-DNODEBUG $(INCLUDE_PATHS)
|
||||||
|
|
||||||
|
VERSION=$(shell git describe)
|
||||||
|
ifdef TRAVIS_OS_NAME
|
||||||
|
OS=$(TRAVIS_OS_NAME)
|
||||||
|
else
|
||||||
|
OS=$(shell uname -s)
|
||||||
|
endif
|
||||||
|
ARCH=$(shell uname -m)
|
||||||
|
ARCHIVE_PATH=optar-$(VERSION)-$(OS)-$(ARCH).tar.gz
|
||||||
|
BINARIES=optar unoptar
|
||||||
|
EXECUTABLES=$(BINARIES) pgm2ps
|
||||||
|
|
||||||
|
ARCHIVE_PATH_TAR=$(ARCHIVE_PATH).tar
|
||||||
|
ARCHIVE_PATH_PDF=$(ARCHIVE_PATH_TAR).pdf
|
||||||
|
|
||||||
all: optar unoptar
|
all: optar unoptar
|
||||||
|
|
||||||
@ -23,7 +38,9 @@ uninstall:
|
|||||||
rm /usr/local/bin/pgm2ps
|
rm /usr/local/bin/pgm2ps
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f optar unoptar golay golay_codes.c *.o
|
rm -f $(BINARIES) optar-*.tar.gz golay_codes.c *.o
|
||||||
|
rm -f $(ARCHIVE_PATH_PDF) $(ARCHIVE_PATH_TAR)
|
||||||
|
rm -f *.pgm *.ps
|
||||||
|
|
||||||
common.o: common.c optar.h
|
common.o: common.c optar.h
|
||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
@ -41,7 +58,7 @@ golay.o: golay.c parity.h
|
|||||||
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
unoptar.o: unoptar.c optar.h parity.h
|
unoptar.o: unoptar.c optar.h parity.h
|
||||||
$(CC) -c -I/usr/local/include/libpng $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
optar: optar.o common.o golay_codes.o parity.o
|
optar: optar.o common.o golay_codes.o parity.o
|
||||||
$(CC) $(LDFLAGS) -o $@ $^
|
$(CC) $(LDFLAGS) -o $@ $^
|
||||||
@ -54,3 +71,17 @@ golay: golay.o parity.o
|
|||||||
|
|
||||||
unoptar: unoptar.o common.o golay_codes.o parity.o
|
unoptar: unoptar.o common.o golay_codes.o parity.o
|
||||||
$(CC) -o $@ -L/usr/local/lib $^ -lm -lpng -lz
|
$(CC) -o $@ -L/usr/local/lib $^ -lm -lpng -lz
|
||||||
|
|
||||||
|
archive: $(ARCHIVE_PATH)
|
||||||
|
|
||||||
|
$(ARCHIVE_PATH): $(EXECUTABLES) COPYING README.md
|
||||||
|
tar czvf $@ $^
|
||||||
|
|
||||||
|
archive_pdf: $(ARCHIVE_PATH_PDF)
|
||||||
|
|
||||||
|
$(ARCHIVE_PATH_PDF): $(ARCHIVE_PATH) optar
|
||||||
|
#This is necessary because tar can be 0-padded and gzip cannot
|
||||||
|
tar cvf $(ARCHIVE_PATH_TAR) $<
|
||||||
|
./optar $(ARCHIVE_PATH_TAR) $(ARCHIVE_PATH_TAR)
|
||||||
|
./pgm2ps *.pgm
|
||||||
|
convert -density 600x600 -quality 100 *.ps $@
|
||||||
|
109
README.md
109
README.md
@ -3,79 +3,112 @@ Twibright Optar
|
|||||||
|
|
||||||
[](https://travis-ci.org/colindean/optar)
|
[](https://travis-ci.org/colindean/optar)
|
||||||
|
|
||||||
This is a program to store data on paper using a 600dpi b/w laser printer and a
|
_**Special note:** The repository of optar at http://github.com/colindean/optar
|
||||||
600+ dpi scanner.
|
exists because I (@colindean) had difficulties finding the source and it seemed
|
||||||
|
to be abandoned/dormant. I've made slight improvements over time. Improvements
|
||||||
|
welcomed as pull requests._
|
||||||
|
|
||||||
You need to install ImageMagick so that the resulting .pgm image can be converted into
|
This is a program to store data on paper using a 600 dpi black and white laser
|
||||||
PostScript with the right dimensions (so each pixel is 3x3 600dpi pixels so that
|
printer and a 600+ dpi scanner.
|
||||||
there is no unnecessary jitter).
|
|
||||||
|
|
||||||
Make sure you have libpng installed and if you type "libpng-config" on the
|
Building
|
||||||
commandline, there's a program which prints something.
|
--------
|
||||||
|
|
||||||
Compile with ``make``. Become root ``su -`` and type ``make install``. Now you have
|
You need to install [ImageMagick](https://www.imagemagick.org) so that the
|
||||||
optar, unoptar and pgm2ps installed on your system in /usr/local/bin. Later
|
resulting .pgm image can be converted into PostScript with the right dimensions:
|
||||||
you can uninstall by typing ``make uninstall`` the same way as you typed
|
each pixel must be 3x3 600dpi pixels so that there is no unnecessary jitter.
|
||||||
``make install``.
|
|
||||||
|
Make sure you have [libpng](http://libpng.org/pub/png/) installed. You'll know
|
||||||
|
that is is installed correctly if you type `libpng-config` on the commandline,
|
||||||
|
there's a program which prints something. Virtually all desktop Linux distros
|
||||||
|
and every macOS system has this installed already.
|
||||||
|
|
||||||
|
Compile with
|
||||||
|
|
||||||
|
make
|
||||||
|
|
||||||
|
Note that there may be some hardcoded configuration values that you may need to
|
||||||
|
change, for example the page size defaults to A4 instead of US Letter. Read on
|
||||||
|
to learn where to change that.
|
||||||
|
|
||||||
|
Installing locally
|
||||||
|
------------------
|
||||||
|
|
||||||
|
It's easiest to install your local build with
|
||||||
|
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
`optar`, `unoptar`, and `pgm2ps` installed on your system in `/usr/local/bin`.
|
||||||
|
|
||||||
|
To uninstall, run
|
||||||
|
|
||||||
|
sudo make uninstall
|
||||||
|
|
||||||
Encoding (writing)
|
Encoding (writing)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Run
|
Run
|
||||||
|
|
||||||
``./optar other_guys.ogg other_guys.ogg``
|
optar other_guys.ogg other_guys.ogg
|
||||||
|
|
||||||
which will produce files:
|
which will produce files:
|
||||||
|
|
||||||
* other_guys.ogg_0001.pgm
|
```
|
||||||
* other_guys.ogg_0002.pgm
|
other_guys.ogg_0001.pgm
|
||||||
* other_guys.ogg_0003.pgm
|
other_guys.ogg_0002.pgm
|
||||||
* other_guys.ogg_0004.pgm
|
other_guys.ogg_0003.pgm
|
||||||
* other_guys.ogg_0005.pgm
|
other_guys.ogg_0004.pgm
|
||||||
* other_guys.ogg_0006.pgm
|
other_guys.ogg_0005.pgm
|
||||||
|
other_guys.ogg_0006.pgm
|
||||||
|
```
|
||||||
|
|
||||||
Now convert them into PostScript using the included pgm2ps tool:
|
Now convert them into PostScript using the included pgm2ps tool:
|
||||||
``./pgm2ps *.pgm``
|
|
||||||
|
|
||||||
Print them using a 600dpi (or more) laser printer. Inkjet or dot matrix was
|
pgm2ps *.pgm
|
||||||
never tested and will not probably work at the pre-defined data density. See
|
|
||||||
"Changing the format" below.
|
Print these using a 600 dpi (or greater resolution) **laser** printer. Inkjet or
|
||||||
|
dot matrix was never tested and will not probably work at the pre-defined data
|
||||||
|
density. See "Changing the format" below.
|
||||||
|
|
||||||
Please note that the file will be padded by zeroes and the original length will
|
Please note that the file will be padded by zeroes and the original length will
|
||||||
be lost. Pack your data with tar if you store data that are sensitive to this.
|
be lost. **Pack your data with tar if you store data that are sensitive to
|
||||||
|
this.**
|
||||||
|
|
||||||
Decoding (reading)
|
Decoding (reading)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
Clean and polish the scanner glass with rubbing alcohol and paper towel. Put
|
Clean and polish the scanner glass with rubbing alcohol and paper towel. Put
|
||||||
yellow pages on the scanner lid to get sharper picture *). Insert the
|
yellow pages on the scanner lid to get sharper picture˚. Insert the
|
||||||
page so that the text on the bottom is upright. Scan the pages into
|
page so that the text on the bottom is upright. Scan the pages into
|
||||||
PNG (not JPEG!) on 600dpi (or 1200dpi, slightly better):
|
PNG (not JPEG!) on 600dpi (or 1200dpi, slightly better):
|
||||||
|
|
||||||
* scan_0001.png
|
```
|
||||||
* scan_0002.png
|
scan_0001.png
|
||||||
* scan_0003.png
|
scan_0002.png
|
||||||
* scan_0004.png
|
scan_0003.png
|
||||||
* scan_0005.png
|
scan_0004.png
|
||||||
* scan_0006.png
|
scan_0005.png
|
||||||
|
scan_0006.png
|
||||||
|
```
|
||||||
|
|
||||||
Read the number sequence (format specification) from any of the papers and feed
|
Read the number sequence (format specification) from any of the papers and feed
|
||||||
it as 1st argument to the optar, 2nd argument is the filename part before the
|
it as 1st argument to the optar, 2nd argument is the filename part before the
|
||||||
underscore:
|
underscore:
|
||||||
|
|
||||||
``unoptar 0-65-93-24-3-1-2-24 scan > out.ogg``
|
unoptar 0-65-93-24-3-1-2-24 scan > out.ogg
|
||||||
|
|
||||||
Then play out.ogg with mplayer. You should get first about 41 seconds from the
|
Then play out.ogg with mplayer. You should get first about 41 seconds from the
|
||||||
Ogg Vorbis file.
|
Ogg Vorbis file.
|
||||||
|
|
||||||
*) In the scanner I tried (Canoscan), the lid didn't seem to be heavy enough to
|
˚ In the scanner I tried (Canoscan), the lid didn't seem to be heavy enough to
|
||||||
press the paper down completely - there were blurry spots in the picture.
|
press the paper down completely - there were blurry spots in the picture.
|
||||||
Without yellow pages I got 526 reparable bad bits bad from 3.2 million. With
|
Without yellow pages I got 526 reparable bad bits bad from 3.2 million. With
|
||||||
yellow pages the blurry spots were much sharper and I got only 261 reparably
|
yellow pages the blurry spots were much sharper and I got only 261 reparably
|
||||||
bad bits!
|
bad bits!
|
||||||
|
|
||||||
Please note the data are padded with zeroes so the original information
|
Please note the data are padded with zeroes so the original information
|
||||||
about file length is lost. If your data format doesn't like this then first
|
about file length is lost. **If your data format doesn't like this then first
|
||||||
pack your data with tar.
|
pack your data with `tar`.**
|
||||||
|
|
||||||
A4 <-> US Letter
|
A4 <-> US Letter
|
||||||
----------------
|
----------------
|
||||||
@ -112,11 +145,13 @@ Future improvement
|
|||||||
Authorship and Licensing
|
Authorship and Licensing
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
© GPL 2007 Karel 'Clock' Kulhavy of Twibright Labs. See COPYING for the text of the GPL license.
|
© GPL 2007 Karel 'Clock' Kulhavy of Twibright Labs.
|
||||||
|
|
||||||
|
See COPYING for the text of the GPL license.
|
||||||
|
|
||||||
e-mail: clock (at) twibright (dot) com
|
e-mail: clock (at) twibright (dot) com
|
||||||
|
|
||||||
Twibright Optar homepage: http://ronja.twibright.com/optar/
|
Twibright Optar homepage: http://ronja.twibright.com/optar/
|
||||||
|
|
||||||
**Special note:** The repository of optar at http://github.com/colindean/optar exists because I
|
Improvements © 2012-2018 Colin Dean
|
||||||
(@colindean) had difficulties finding the source and it seemed to be abandoned/dormant.
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user