0

I have an image wiht gtk.gdk. I want to make it look grayed out, so I wanna do something like draw a gray rectangle over it with 50% alpha value. How would I do this? The docs are so confusing.

Claudiu
  • 224,032
  • 165
  • 485
  • 680
  • Ah [this question](http://stackoverflow.com/questions/3048148/alpha-blending-in-gtk) has the answer. it's just that the pygtk documentation is not complete. i'll post code on how exactly to do it, though, since i feel that will help someone. or ill post it as an answer to that answer, so no duplicates. – Claudiu Feb 09 '11 at 16:15
  • You could also reduce the brightness of each channel in the image by half. – Dana the Sane Feb 09 '11 at 17:42
  • @Dana the Sane: That would only makje the image darker, not grayer. For grayer, one has to average each pixel component with 0.5 (or 128) – jsbueno Feb 09 '11 at 19:07
  • Was this solved? If so, an answer needs to be posted. – CodeMouse92 Dec 25 '11 at 06:57

1 Answers1

0

i just thought of a way taking half of the color's highest values and taking half of the number directly between them and putting that on the lowest number (Eg: 0,255,255 to 127,255,255 or 0,127,255 to 96,127,255) or taking the second highest number and the highest number, finding the 50%, putting that as the second highest number, then doing that again for the absolute lowest number (Eg: 0,128,255 > 112,192,255) hope this works for me and for you, right now im recommending to myself and you, the second option, however if you're lazy, the first option is less work