Mercurial > hg > config
annotate python/clean_whiteboard.py @ 659:e5be32fea639
https://gist.github.com/lelandbatey/8677901
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Thu, 03 Apr 2014 11:53:23 -0700 |
parents | |
children | f77be2334246 |
rev | line source |
---|---|
659
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
3 |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
4 """ |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
5 From https://gist.github.com/lelandbatey/8677901 |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
6 |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
7 #!/bin/bash |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
8 convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2 |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
9 """ |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
10 |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
11 import argparse |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
12 import os |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
13 import subprocess |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
14 import sys |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
15 |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
16 __all__ = ['main'] |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
17 here = os.path.dirname(os.path.realpath(__file__)) |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
18 string = (str, unicode) |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
19 |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
20 def main(args=sys.argv[1:]): |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
21 |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
22 # parse command line |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
23 parser = argparse.ArgumentParser(description=__doc__) |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
24 parser.add_argument('input', nargs='?', |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
25 type=argparse.FileType('r'), default=sys.stdin, |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
26 help='input file, or read from stdin if ommitted') |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
27 options = parser.parse_args(args) |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
28 |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
29 if __name__ == '__main__': |
e5be32fea639
https://gist.github.com/lelandbatey/8677901
Jeff Hammel <k0scist@gmail.com>
parents:
diff
changeset
|
30 main() |