commit c7c82215f1b892845a60a2ea4a3e97708197a30a
parent 83d987cba9ed0d80ee145e8797c93cdcbc1fc701
Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Thu, 13 Feb 2014 22:17:24 +0100
Program functional, generates readme with example
Diffstat:
6 files changed, 88 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
@@ -0,0 +1,9 @@
+README.rst: generate-readme.sh cross-stitch.py fisker-pattern.png
+ @bash $< $@
+
+fisker-pattern.png: cross-stitch.py fiskeren.jpg
+ @python $< -i fiskeren.jpg -o $@
+
+clean:
+ $(RM) README.rst
+ $(RM) fisker-pattern.png
diff --git a/README.rst b/README.rst
@@ -1,5 +1,5 @@
cross-stitch
-------------
+============
A Python application to turn your images into patterns for cross stitching.
@@ -17,11 +17,29 @@ License
-------
GNU Public License version 3 or newer. See LICENSE.txt for details.
+Author
+------
+Anders Damsgaard (andersd@riseup.net)
+
Usage
-----
- usage: cross-stitch.py [-h] --infile FILENAME --outfile FILENAME [--dpi DPI]
+
+./cross-stitch.py -h
+
+Example
+-------
+
+ $ ./cross-stitch.py -i fiskeren.jpg -o fisker-pattern.py -w 50
+
+.. image:: fiskeren.jpg
+ :scale: 50 %
+ :alt: Original image
+ :align: left
+
+.. image:: fisker-pattern.png
+ :scale: 60 %
+ :alt: Cross stitching pattern
+ :align: right
+
-Author
-------
-Anders Damsgaard (andersd@riseup.net)
diff --git a/cross-stitch.py b/cross-stitch.py
@@ -24,7 +24,7 @@ parser.add_argument('--n-colors', '-c', type=int, nargs=1, default=10,
args = parser.parse_args()
infile = args.infile[0]
outfile = args.outfile[0]
-width = args.width[0]
+width = args.width
## Read image ##################################################################
try:
diff --git a/fisker-pattern.png b/fisker-pattern.png
Binary files differ.
diff --git a/fiskeren.jpg b/fiskeren.jpg
Binary files differ.
diff --git a/generate-readme.sh b/generate-readme.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+
+# Pass README output file name as argument
+
+HEADER="cross-stitch
+============
+
+A Python application to turn your images into patterns for cross stitching.
+
+https://github.com/anders-dc/cross-stitch
+
+Requirements
+------------
+Python 2 or 3, Numpy, Scipy, and Matplotlib.
+
+To install these dependencies in Debian and its derivatives, run:
+
+ $ sudo apt-get install python python-numpy python-scipy python-matplotlib
+
+License
+-------
+GNU Public License version 3 or newer. See LICENSE.txt for details.
+
+Author
+------
+Anders Damsgaard (andersd@riseup.net)
+
+Usage
+-----
+
+ "
+
+echo "Generating $1"
+echo "$HEADER" > $1
+echo ./cross-stitch.py -h >> $1
+
+EXAMPLE="
+Example
+-------
+
+ $ ./cross-stitch.py -i fiskeren.jpg -o fisker-pattern.py -w 50
+
+.. image:: fiskeren.jpg
+ :scale: 50 %
+ :alt: Original image
+ :align: left
+
+.. image:: fisker-pattern.png
+ :scale: 60 %
+ :alt: Cross stitching pattern
+ :align: right
+
+"
+
+echo "$EXAMPLE" >> $1