By Paras Rawat
A python script to add watermark to image files using multiple modules of the PIL library.
First, we will import all the required modules Image, ImageDraw, ImageFont from the PIL library.
Now create an image object of the image file to which we want to add the watermark.
We will set the width and height variables with the width and height of the image to which we want to add the watermark using the inbuilt function size.
Create another object draw using the ImageDraw module that will be used to draw in the image and set the text variable with your desired watermark.
Now we will set the font, text width, and text size for our watermark and calculate the coordinates for our watermark so that we can place it in the bottom right corner of the image.
With the help of the text method, we will draw the watermark in the image in the coordinates provided to the method.
Save the new image with your watermark.
Submitted by Paras Rawat (Paras07)
Download packets of source code on Coders Packet