[Image-SIG] Image to Matrix to Image.

Fredrik Lundh fredrik at pythonware.com
Mon Aug 11 21:03:12 CEST 2008

Talat Fakhri wrote:

> I am a newbie here. I would like to know if there is any function which 
> converts Images to Matrix(RGB or greyscale etc) and another function 
> which converts the matrix into Image file?

"matrix" as in?

If you just want to work with the image data as Python sequence, use 
getdata/putdata, or pixel access objects:

    >>> im = Image.open("image.jpg")
    >>> pix = im.load()
    >>> pix[0, 0]
    (226, 162, 125)
    >>> pix[0, 0] = (0, 0, 0)


More information about the Image-SIG mailing list