Open In App

Python PIL | ImageOps.grayscale() method

Last Updated : 27 Oct, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageOps module contains a number of ‘ready-made’ image processing operations. This module is somewhat experimental, and most operators only work on L and RGB images.
ImageOps.grayscale() Convert the image to grayscale. The complete pixel turns to gray, no other color will be seen.
 

Syntax: PIL.ImageOps.grayscale(image) 
Parameters
image – The image to convert into grayscale.
Returns An image. 
 

Image Used: 
 

 

Python3




# Importing Image and ImageOps module from PIL package
from PIL import Image, ImageOps
     
# creating a image1 object
im1 = Image.open(r"C:\Users\System-Pc\Desktop\a.JPG")
 
# applying grayscale method
im2 = ImageOps.grayscale(im1)
 
im2.show()


Output:
 

 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads