def solarize(image, threshold=128):
 lut = []
 for i in range(256):
  if (i < threshold):
   lut.append(i)
  else:
   lut.append((255 - i))
 return _lut(image, lut)

def solarize ( image , threshold = 128 ) : lut = [ ] for i in range ( 256 ) : if ( i < threshold ) : lut . append ( i ) else : lut . append ( ( 255 - i ) ) return _lut ( image , lut )
invert all pixel values above a threshold .