En Tue, 19 Feb 2008 04:01:04 -0200, vaneric <[EMAIL PROTECTED]>
escribió:
> On Feb 19, 1:38 am, Robert Kern <[EMAIL PROTECTED]> wrote:
>> Averaging color
>> images is tricky; you really shouldn't do it in the RGB colorspace.
>
> hi,
> thanx for the guidance and detailed replies..I tried to pack the
> r,g,b into a single value like below(something a member posted in the
> past)
>
> def rgbTopixelvalue((r,g,b)):
> alpha=255
> return unpack("l", pack("BBBB", b, g, r, alpha))[0]
That's much worse than averaging the R,G,B components. First, you have to
omit the alfa value (or set it at the end). Then, consider this example:
(0,0,0)=black and (0,1,0)=almost black, average = (0,0,128) = dark blue, a
total nonsense.
As said above, try to compute using another color space, try HSL. The
colorsys module can transform from/to RGB.
--
Gabriel Genellina
--
http://mail.python.org/mailman/listinfo/python-list