tAdded parsing of input arguments - cross-stitch - interactively turn images into patterns for cross stitching (HTM) git clone git://src.adamsgaard.dk/cross-stitch (DIR) Log (DIR) Files (DIR) Refs (DIR) LICENSE --- (DIR) commit b27bd4e8db7fd4107c7a7825c6bc949cda7bbb67 (DIR) parent 44a7f7afe6ca7d58c264ac2b4edb327bf24e0549 (HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk> Date: Thu, 13 Feb 2014 20:26:16 +0100 Added parsing of input arguments Diffstat: M README.rst | 5 +++++ A cross-stitch.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 0 deletions(-) --- (DIR) diff --git a/README.rst b/README.rst t@@ -13,6 +13,11 @@ License ------- GNU Public License version 3 or newer. See LICENSE.txt for details. +Usage +----- + + usage: cross-stitch.py [-h] --infile FILENAME --outfile FILENAME [--dpi DPI] + Author ------ Anders Damsgaard (andersd@riseup.net) (DIR) diff --git a/cross-stitch.py b/cross-stitch.py t@@ -0,0 +1,29 @@ +#!/usr/bin/env python + +#import os, sys, getopt, Image +import argparse + +#import numpy as np +#import matplotlib.pyplot as plt + +class image: + def __init__(self, in_file_path): + pass + +program_description = \ + '''Downsamples and modifies an image in order to create a pattern for + cross stitching.''' +parser = argparse.ArgumentParser(description = program_description) +parser.add_argument('--infile', '-i', metavar='FILENAME', type=str, nargs=1, + required=True, help='input image to process') +parser.add_argument('--outfile', '-o', metavar='FILENAME', type=str, nargs=1, + required=True, help='save processed image as FILENAME') +parser.add_argument('--dpi', '-r', type=int, nargs=1, default=5, + help='output file resolution (dots per inch), default value = 5') +args = parser.parse_args() +infile = args.infile[0] +outfile = args.outfile[0] +resolution = args.dpi +print infile +print outfile +print resolution