Open In App

Python PIL | ImageOps.equalize() method

Last Updated : 29 Jun, 2019
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.equalize() method equalizes the image histogram. This function applies a non-linear mapping to the input image, in order to create a uniform distribution of grayscale values in the output image.

Syntax: PIL.ImageOps.equalize(image, mask=None)

Parameters:
image: The image to equalize.
mask: An optional mask. If given, only the pixels selected by the mask are included in the analysis.

Returns: An image.

Image used:




# Importing Image and ImageOps module from PIL package  
from PIL import Image, ImageOps 
    
# creating a image1 object 
im1 = Image.open(r"C:\Users\sadow984\Desktop\download2.JPg")
     
# applying equalize method 
im2 = ImageOps.equalize(im1, mask = None)
  
im2.show() 


Output:


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

Similar Reads