1

I am new in Python. I am working in Ubuntu and I studying from Lambert K.A. - Fundamentals of Python From First Programs through Data Structures - 2009.

I am working on image processing. I am trying to use the image.setPixel(0,0), and prior to this I have inserted the following commands to the shell.

from images import Image

image = Image("animage.gif")

image.getPixel(0,0)

This supposed to give the RGB value at the specified pixel however it gives an error as:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/lib-tk/images.py", line 115, in getPixel
    return tuple(map(int, value.split()))
AttributeError: 'tuple' object has no attribute 'split'

the images.py file is provided, where the getPixel() function is as follows:

def getPixel(self, x, y):
    """Returns a tuple (r,g,b) with the RGB color values for pixel (x,y)
    r,g,b are in range(256)

    """
    value = self.image.get(x, y)
    if type(value) == int:
        return (value, value, value)
    else:
        return tuple(map(int, value.split()))

I do not know if it could be related but I believe I have made the required PIL downloads.

I would appreciate your suggestions on the issue.

grigri
  • 11
  • 1
  • 2
  • Hi @Gozde See this [Link](http://stackoverflow.com/questions/11064786/get-pixels-rgb-using-pil) – bud-e Oct 10 '14 at 08:44

0 Answers0