PaletteOptimiser

Changeset

39:a53123d8da0a
2015-10-04 Paul Boddie raw files shortlog changelog graph Use the square of each scaled colour value to diminish the image intensity.
optimiser.py (file)
     1.1 --- a/optimiser.py	Sun Oct 04 00:32:47 2015 +0200
     1.2 +++ b/optimiser.py	Sun Oct 04 15:17:31 2015 +0200
     1.3 @@ -29,11 +29,14 @@
     1.4  def scale(rgb):
     1.5      return tuple(map(lambda x: x / 255.0, rgb))
     1.6  
     1.7 +def square(srgb):
     1.8 +    return tuple(map(lambda x: pow(x, 2), srgb))
     1.9 +
    1.10  def invert(srgb):
    1.11      return tuple(map(lambda x: 1.0 - x, srgb))
    1.12  
    1.13  def combination(rgb):
    1.14 -    rgb = scale(rgb)
    1.15 +    rgb = square(scale(rgb))
    1.16      rgbi = invert(rgb)
    1.17      pairs = zip(rgbi, rgb)
    1.18      d = []