Python PIL | ImageOps.solarize() 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.solarize() Invert all pixel values above a threshold, threshold simply means image segmentation.
Syntax: PIL.ImageOps.solarize(image, threshold=130)
Parameters:
image – The image to solarize.
threshold – All pixels above this grayscale level are inverted.
Returns: An image.
Image Used:
Python3
from PIL import Image, ImageOps
im1 = Image. open (r "C:\Users\System-Pc\Desktop\a.JPG" )
im2 = ImageOps.solarize(im1, threshold = 130 )
im2.show()
|
Output:
Last Updated :
23 Dec, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...