1.1 --- a/optimiser.py Mon Oct 12 12:05:24 2015 +0200
1.2 +++ b/optimiser.py Mon Oct 12 18:10:53 2015 +0200
1.3 @@ -100,9 +100,14 @@
1.4 elif "--test-flat" in sys.argv:
1.5 test_flat((120, 40, 60))
1.6 sys.exit(0)
1.7 - elif "--help" in sys.argv:
1.8 + elif "--help" in sys.argv or len(sys.argv) < 3:
1.9 + basename = split(sys.argv[0])[1]
1.10 print >>sys.stderr, """\
1.11 -Usage: %s <input filename> <output filename> [ <options> ]
1.12 +Usage:
1.13 +
1.14 +%s <input filename> <output filename> [ <options> ]
1.15 +
1.16 +%s -v <filename> [ -C <number of colours> ]
1.17
1.18 Options are...
1.19
1.20 @@ -126,9 +131,10 @@
1.21 -v - Verify the output image (loaded if -n is given)
1.22 -n - Generate no output image
1.23
1.24 -An input filename of - implies the -n option, and is useful for verifying
1.25 -previously generated images.
1.26 -""" % split(sys.argv[0])[1]
1.27 +Specifying -v instead of input filename permits the verification of
1.28 +previously-generated images. Doing so causes all other options except for -C
1.29 +to be ignored.
1.30 +""" % (basename, basename)
1.31 sys.exit(1)
1.32
1.33 base_width = width = 320
1.34 @@ -138,6 +144,7 @@
1.35 basename, ext = splitext(output_filename)
1.36 preview_filename = "".join([basename + "_preview", ext])
1.37
1.38 + verify_only = input_filename == "-v"
1.39 options = sys.argv[3:]
1.40
1.41 # Basic image properties.
1.42 @@ -158,12 +165,15 @@
1.43
1.44 # General output options.
1.45
1.46 + no_normal_output = "-n" in options or verify_only
1.47 + verify = "-v" in options or verify_only
1.48 +
1.49 + rotate = "-r" in options and not verify_only
1.50 + preview = "-p" in options and not verify_only
1.51 +
1.52 + half_resolution_preview = "-h" in options
1.53 least_error = "-l" in options
1.54 - rotate = "-r" in options
1.55 - preview = "-p" in options
1.56 - half_resolution_preview = "-h" in options
1.57 - verify = "-v" in options
1.58 - no_normal_output = "-n" in options or input_filename == "-"
1.59 +
1.60 make_image = not no_normal_output
1.61
1.62 # Load the input image if requested.