Saturday, November 16, 2024
Google search engine
HomeLanguagesPython PIL | ImageOps.equalize() method

Python PIL | ImageOps.equalize() method

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:

RELATED ARTICLES

Most Popular

Recent Comments