Open In App

Python PIL | ImageChops.multiply() method

Last Updated : 25 Jun, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

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.multiply() method superimposes two images on top of each other.
If you multiply an image with a solid black image, the result is black. If you multiply with a solid white image, the image is unaffected. At least one of the images must have mode “1”.

Syntax: PIL.ImageChops.multiply(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 multiply method
im3 = ImageChops.multiply(im1, im2)
   
im3.show()


Output:

Image3:

Image4:




# Importing Image and ImageChops module from PIL package 
from PIL import Image, ImageChops
    
# creating a image3 object
im1 = Image.open(r"C:\Users\sadow984\Desktop\a2.PNG")
    
# creating a image4 object
im2 = Image.open(r"C:\Users\sadow984\Desktop\a3.PNG")
   
# applying multiply method
im3 = ImageChops.multiply(im1, im2)
   
im3.show()


Output:



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads