how to get rgbdata

Diez B. Roggisch deets at nospam.web.de
Tue Oct 9 06:12:20 EDT 2007


 sajanjoseph at gmail.com wrote:

> Hi i am a newbie to python and PIL. can anyone tell me how to get
> rgbdata from a jpeg image using PIL
> as a double[] . is there an equiv method to java's
> BufferedImage.getRGB(0,0,width,height,rgbdata,0,width) ?

The docs of PIL are quite good. And there you find the method

Image.getdata()

that does what you want. At least in a way, as it returns a slightly
different format (tuples of ints istead of floats), but I presume you can
convert that by yourself.

http://www.pythonware.com/library/pil/handbook/image.htm


Diez



More information about the Python-list mailing list