Re: PIL and getpixel()

2007-10-16 Thread [EMAIL PROTECTED]

> Just pack the RGB values into an `int` by shifting and or-ing.  Untested:
>
> red, green, blue = img.getpixel(x, y)
> pixel_as_int = red << 16 | green << 8 | blue
>
> Ciao,
> Marc 'BlackJack' Rintsch

thanx Marc

will try that
dn

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: PIL and getpixel()

2007-10-16 Thread Marc 'BlackJack' Rintsch
On Tue, 16 Oct 2007 07:05:56 +, [EMAIL PROTECTED] wrote:

> i am trying to get the pixel data using im.getpixel()
> i am getting a tuple like (152,118,106) for a pixel in a RGB jpeg
> image .
> what i really want is an integer value representing a pixel ,like waht
> i can get from java's BufferedImage.getRGB(x,y) ..
> 
> i am wondering if someone can advise me on how i can do this

Just pack the RGB values into an `int` by shifting and or-ing.  Untested:

red, green, blue = img.getpixel(x, y)
pixel_as_int = red << 16 | green << 8 | blue

Ciao,
Marc 'BlackJack' Rintsch
-- 
http://mail.python.org/mailman/listinfo/python-list