Python PIL | putpixel() 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.
putpixel() Modifies the pixel at x, y. The color is given as a single numerical value for single band images, and a tuple for multi-band images
Syntax: putpixel(self, xy, color)
xy :The pixel coordinate, given as (x, y)
value: – The pixel value.
Returns: An Image with pixel .
Another example:Here we change the color parameter.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course