<s> import Image , ImageFilter , ImageStat <EOL> class _Enhance : <EOL> def enhance ( self , factor ) : <EOL> return Image . blend ( self . degenerate , self . image , factor ) <EOL> class Color ( _Enhance ) : <EOL> "<STR_LIT>" <EOL> def __init__ ( self , image ) : <EOL> self . image = image <EOL> self . degenerate = image . convert ( "<STR_LIT:L>" ) . convert ( image . mode ) <EOL> class Contrast ( _Enhance ) : <EOL> "<STR_LIT>" <EOL> def __init__ ( self , image ) : <EOL> self . image = image <EOL> mean = int ( ImageStat . Stat ( image . convert ( "<STR_LIT:L>" ) ) . mean [ <NUM_LIT:0> ] + <NUM_LIT:0.5> ) <EOL> self . degenerate = Image . new ( "<STR_LIT:L>" , image . size , mean ) . convert ( image . mode ) <EOL> class Brightness ( _Enhance ) : <EOL> "<STR_LIT>" <EOL> def __init__ ( self , image ) : <EOL> self . image = image <EOL> self . degenerate = Image . new ( image . mode , image . size , <NUM_LIT:0> ) <EOL> class Sharpness ( _Enhance ) : <EOL> "<STR_LIT>" <EOL> def __init__ ( self , image ) : <EOL> self . image = image <EOL> self . degenerate = image . filter ( ImageFilter . SMOOTH ) </s>
