PIL — is a Python image library that provides the Python interpreter with image editing capabilities. The PixelAccess class provides pixel-level read and write access to PIL.Image data.
Accessing individual pixels is rather slow. If you are looping over all the pixels in an image, there is probably a faster way to use the other parts of the pillows API.
getpixel () Returns the pixel at point x, y. Pixel is returned as single
Syntax: getpixel (self, xy)
Parameters:
xy: The pixel coordinate, given as (x, y).
Returns: a pixel value for single band images, a tuple of pixel values for multiband images.
Image used:
|
Output:
(130, 105, 49) (0, 0, 0) (75, 19, 0)
Another example: here we change the value of the coordinate.
Image is being used
|
Output:
(130, 105, 49) (0, 0, 0) (22, 168, 25)