[Image-SIG] Help On Converting Colours...

Andrea Gavana andrea_gavana at tin.it
Sun Oct 16 23:58:43 CEST 2005

Hello NG,

    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 and some other pixels are brighter or darker in order to give the 3D effect on that image.

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 same 3D effects.

Thanks a lot for every suggestion, and sorry if it is a basic question. I just started to learn PIL.


P.S. I am trying also to use Numarray (Numeric) in order to do this transformation. Someone suggested me to use the function rgb_to_hsv on every pixel and then to change only the "hue" value, to obtain another colour for every pixel, in order to obtain the same 3D effect. 
I think I have found the way to do it, but doing that for every pixel is quite slow... is there a way to do it more "globally" (I mean on the whole image)? Or, as alternative, can I identify the pixels that share the same colour and then apply the transformation on all them?

Thanks a lot for all your suggestions.


"Imagination Is The Only Weapon In The War Against Reality."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/image-sig/attachments/20051016/0870ab03/attachment.htm

More information about the Image-SIG mailing list