Python PIL | ImageChops.darker() method
Last Updated :
21 Jun, 2019
PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities.
ImageChops.darker()
method is used to compare two images pixel by pixel, and returns a new image containing the darker values.
Syntax: ImageChops.darker(image1, image2)
Parameters:
image1: It is the image object or image path of first image.
image2: It is the image object or image path of second image.
Return Value: An Image
Note: Both images should be of same MODE.
Code #1:
from PIL import ImageChops, Image
im1 = Image. open (r "C:\Users\Admin\Pictures\download.png" )
im2 = Image. open (r "C:\Users\Admin\Pictures\images.png" )
im = ImageChops.darker(im1, im2)
im.show()
|
Output:
Code #2:
from PIL import ImageChops, Image
im1 = Image. open (r "C:\Users\Admin\Pictures\geeks.png" )
im2 = Image. open (r "C:\Users\Admin\Pictures\capture.png" )
im = ImageChops.darker(im1, im2)
im.show()
|
Output:
Note: Don’t get confused with Image.blend()
method. This method is totally different
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...