Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python PIL | ImageChops.lighter() method

  • Last Updated : 25 Jun, 2019

PIL is the Python Imaging Library which provides the python interpreter with image editing capabilities. The ImageChops module contains a number of arithmetical image operations, called channel operations (“chops”). These can be used for various purposes, including special effects, image compositions, algorithmic painting, and more.
PIL.ImageChops.lighter() method compares the two images, pixel by pixel, and returns a new image containing the lighter values. At least one of the images must have mode “1”.
Syntax: PIL.ImageChops.lighter(image1, image2)

Parameters:
image1: first image
image2: second image

Return Type: Image

Image1:

Image2:




# Importing Image and ImageChops module from PIL package 
from PIL import Image, ImageChops
   
# creating a image1 object
im1 = Image.open(r"C:\Users\sadow984\Desktop\i3.PNG")
   
# creating a image2 object
im2 = Image.open(r"C:\Users\sadow984\Desktop\c1.PNG")
  
# applying lighter method
im3 = ImageChops.lighter(im1, im2)
  
im3.show()

Output:




# Importing Image and ImageChops module from PIL package 
from PIL import Image, ImageChops
   
# creating a image1 object
im1 = Image.open(r"C:\Users\sadow984\Desktop\i3.PNG")
   
# creating a image2 object
im2 = Image.open(r"C:\Users\sadow984\Desktop\c1.PNG")
  
# applying lighter method
im3 = ImageChops.lighter(im2, im1)
  
im3.show()

Output: [on interchanging the parameters ]


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!