Python PIL | getpixel() Method
PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The PixelAccess class provides read and write access to PIL.Image data at a pixel level.
Accessing individual pixels is fairly slow. If you are looping over all of the pixels in an image, there is likely a faster way using other parts of the Pillow API.
getpixel() Returns the pixel at x, y. The pixel is returned as a single
Syntax: getpixel(self, xy)
xy :The pixel coordinate, given as (x, y).
Returns: a pixel value for single band images, a tuple of pixel values for multiband images.
(130, 105, 49) (0, 0, 0) (75, 19, 0)
Another example:Here we change the coordinate value.
(130, 105, 49) (0, 0, 0) (22, 168, 25)
Last Updated on December 29, 2021 by admin