1.1 --- a/optimiser.py Sun Oct 11 20:12:30 2015 +0200
1.2 +++ b/optimiser.py Sun Oct 11 23:29:34 2015 +0200
1.3 @@ -118,11 +118,18 @@
1.4 -D - Darken the input image (optional float, 1.0 if unspecified)
1.5 -B - Brighten the input image (optional float, 1.0 if unspecified)
1.6
1.7 --r - Rotate the input image clockwise
1.8 +-l - Use colours producing the least error
1.9 + (slower but useful for fewer than 4 colours)
1.10 +
1.11 +-r - Rotate the input image clockwise explicitly
1.12 + (EXIF information is used otherwise)
1.13 -p - Generate a separate preview image
1.14 -h - Make the preview image with half horizontal resolution (MODE 2)
1.15 -v - Verify the output image (loaded if -n is given)
1.16 -n - Generate no output image
1.17 +
1.18 +An input filename of - implies the -n option, and is useful for verifying
1.19 +previously generated images.
1.20 """ % split(sys.argv[0])[1]
1.21 sys.exit(1)
1.22
1.23 @@ -149,11 +156,12 @@
1.24
1.25 # General output options.
1.26
1.27 + least_error = "-l" in options
1.28 rotate = "-r" in options
1.29 preview = "-p" in options
1.30 half_resolution_preview = "-h" in options
1.31 verify = "-v" in options
1.32 - no_normal_output = "-n" in options
1.33 + no_normal_output = "-n" in options or input_filename == "-"
1.34 make_image = not no_normal_output
1.35
1.36 # Load the input image if requested.
1.37 @@ -184,7 +192,7 @@
1.38 # Generate an output image if requested.
1.39
1.40 if make_image:
1.41 - convert_image(im, number_of_colours)
1.42 + convert_image(im, number_of_colours, least_error)
1.43 im.save(output_filename)
1.44
1.45 # Verify the output image (which may be loaded) if requested.