Code

Translations. French translation minor update.
[inkscape.git] / share / extensions / color_grayscale.py
1 #!/usr/bin/env python
2 import coloreffect
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     ig=int(round(l))
11     #coloreffect.debug('gs '+hex(r)+' '+hex(g)+' '+hex(b)+'%02x%02x%02x' % (ig,ig,ig))
12     return '%02x%02x%02x' % (ig,ig,ig)
14 c = C()
15 c.affect()