1 #!/usr/bin/env python
2 import coloreffect,sys
4 class C(coloreffect.ColorEffect):
5 def colmod(self,r,g,b):
6 #ITU-R Recommendation BT.709
7 #l = 0.2125 * r + 0.7154 * g + 0.0721 * b
8 #NTSC and PAL
9 l = 0.299 * r + 0.587 * g + 0.114 * b
10 if l > 127:
11 ig = 255
12 else:
13 ig = 0
14 #coloreffect.debug('gs '+hex(r)+' '+hex(g)+' '+hex(b)+'%02x%02x%02x' % (ig,ig,ig))
15 return '%02x%02x%02x' % (ig,ig,ig)
17 c = C()
18 c.affect()