-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsvg2json
executable file
·28 lines (24 loc) · 877 Bytes
/
svg2json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/python
def positive_int(val):
i = int(val)
if i < 0:
raise argparse.ArgumentTypeError('invalid positive_int value: {}'.format(val))
return i
import argparse
from svglabel import svg2json
if __name__ == '__main__':
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('svgfile')
parser.add_argument('imfile')
parser.add_argument('-o', '--outfile')
parser.add_argument('-l', '--labelfile')
parser.add_argument('-s', '--segments', type=positive_int, default=10,
help='Number of additional line segments inserted between points.')
args = parser.parse_args()
svg2json(args.svgfile,
args.imfile,
outfile=args.outfile,
labelfile=args.labelfile,
segments=args.segments,
)