1.1 --- a/optimiser.py Fri Oct 09 00:40:59 2015 +0200
1.2 +++ b/optimiser.py Fri Oct 09 01:30:38 2015 +0200
1.3 @@ -294,8 +294,8 @@
1.4
1.5 -s - Saturate the input image (can be repeated)
1.6 -d - Desaturate the input image (can be repeated)
1.7 --D - Darken the input image (can be repeated)
1.8 --B - Brighten the input image (can be repeated)
1.9 +-D - Darken the input image (can be repeated or followed by a float)
1.10 +-B - Brighten the input image (can be repeated or followed by a float)
1.11 -2 - Square/diminish the bright corner colour contributions (experimental)
1.12
1.13 -r - Rotate the input image clockwise
1.14 @@ -322,6 +322,15 @@
1.15 darken = options.count("-D")
1.16 brighten = options.count("-B")
1.17
1.18 + if darken == 1:
1.19 + i = options.index("-D")
1.20 + if options[i+1].isdigit():
1.21 + darken = float(options[i+1])
1.22 + if brighten == 1:
1.23 + i = options.index("-B")
1.24 + if options[i+1].isdigit():
1.25 + brighten = float(options[i+1])
1.26 +
1.27 # Experimental colour distribution modification.
1.28
1.29 use_square = "-2" in options
1.30 @@ -353,7 +362,7 @@
1.31 if saturate or desaturate:
1.32 rgb = saturate_rgb(rgb, saturate and math.pow(0.5, saturate) or math.pow(2, desaturate))
1.33 if darken or brighten:
1.34 - rgb = amplify_rgb(rgb, brighten and math.pow(0.5, brighten) or math.pow(2, darken))
1.35 + rgb = amplify_rgb(rgb, brighten and 0.5 / brighten or 2 * darken)
1.36 im.putpixel((x, y), rgb)
1.37
1.38 # Generate a preview if requested.