Open In App
Related Articles

Python PIL | ImageChops.darker() method

Improve Article
Improve
Save Article
Save
Like Article
Like

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:




# importing Image class from PIL package
from PIL import ImageChops, Image
  
# opening images to compare
im1 = Image.open(r"C:\Users\Admin\Pictures\download.png")
im2 = Image.open(r"C:\Users\Admin\Pictures\images.png")
  
# Checking and returning a copy
# of image contating darker pixels
im = ImageChops.darker(im1, im2)
  
# showing image
im.show()


Output:

Code #2:




# importing Image class from PIL package
from PIL import ImageChops, Image
  
# opening images to compare
im1 = Image.open(r"C:\Users\Admin\Pictures\geeks.png")
im2 = Image.open(r"C:\Users\Admin\Pictures\capture.png")
  
# Checking and returning a copy
# of image contating darker pixels
im = ImageChops.darker(im1, im2)
  
# showing image
im.show()


Output:

Note: Don’t get confused with Image.blend() method. This method is totally different


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 21 Jun, 2019
Like Article
Save Article
Previous
Next
Similar Reads
Complete Tutorials