[PIL]: Question On Changing Colour

2005-10-17 Thread Andrea Gavana
Hello Terry, new_hue # your 'basic color', just the hue part rgb_base # color from the basic button image rgb_new # the new color you want to replace rgb_base with rgb_new = hsv_to_rgb( (new_hue,) + rgb_to_hsv(rgb_base)[1:]) thanks a lot for your suggestion! However, either I did not

Re: [PIL]: Question On Changing Colour

2005-10-17 Thread Terry Hancock
On Thursday 13 October 2005 02:58 pm, Andrea Gavana wrote: # that is the old colour -- GREY rgb_old = (0.7, 0.7, 0.7) So, no matter what colour I choose as a new colour, the Hue part of the new colour doesn't change in RGB. In other words, leaving the old value for Saturation and Value

Re: [PIL]: Question On Changing Colour

2005-10-14 Thread Iain King
Andrea Gavana wrote: I have tried your solution, Terry: new_hue # your 'basic color', just the hue part rgb_base # color from the basic button image rgb_new # the new color you want to replace rgb_base with rgb_new = hsv_to_rgb( (new_hue,) + rgb_to_hsv(rgb_base)[1:]) thanks a

Re: [PIL]: Question On Changing Colour

2005-10-14 Thread Scott David Daniels
Confusion about applying hue to a grey value Try this: import colorsys as cs grey = (.7, .7, .7) blue = (0., 0., 1.) hsv_grey = cs.rgb_to_hsv(*grey) hsv_blue = cs.rgb_to_hsv(*blue) hsv_grey (0.0, 0.0, 0.69996) hsv_blue (0.3, 1.0, 1.0) The problem is that

Re: [PIL]: Question On Changing Colour

2005-10-13 Thread Andrea Gavana
I have tried your solution, Terry: new_hue # your 'basic color', just the hue part rgb_base # color from the basic button image rgb_new # the new color you want to replace rgb_base with rgb_new = hsv_to_rgb( (new_hue,) + rgb_to_hsv(rgb_base)[1:]) thanks a lot for your suggestion!

[PIL]: Question On Changing Colour

2005-10-11 Thread Andrea Gavana
Hello NG, First of all, sorry if this is not the right newsgroup. I have a small image that looks like a GUI button (with 3D effects given by different pixels colours). The current image has as "basic" colour the grey. For "basic", I mean that the predominant colour in the image is grey

Re: [PIL]: Question On Changing Colour

2005-10-11 Thread Terry Hancock
On Wednesday 12 October 2005 05:28 pm, Andrea Gavana wrote: Now my question: is it possible to transform the pixels colours in order to have another basic colour (say blue)? In other words, the predominant colour will become the blue, with other pixels in a brighter or darker blue to give the

Re: [PIL]: Question On Changing Colour

2005-10-11 Thread jepler
If you're always going from grey to tinted, then the easiest way is to treat it as a 'P' image with a special palette. I believe this function will prepare the palette: def make_palette(tr, tg, tb): l = [] for i in range(255): l.extend([tr*i / 255,