
- Python Pillow - Home
- Python Pillow - Overview
- Python Pillow - Environment Setup
- Basic Image Operations
- Python Pillow - Working with Images
- Python Pillow - Resizing an Image
- Python Pillow - Flip and Rotate Images
- Python Pillow - Cropping an Image
- Python Pillow - Adding Borders to Images
- Python Pillow - Identifying Image Files
- Python Pillow - Merging Images
- Python Pillow - Cutting and Pasting Images
- Python Pillow - Rolling an Image
- Python Pillow - Writing text on image
- Python Pillow - ImageDraw Module
- Python Pillow - Concatenating two Images
- Python Pillow - Creating Thumbnails
- Python Pillow - Creating a Watermark
- Python Pillow - Image Sequences
- Python Pillow Color Conversions
- Python Pillow - Colors on an Image
- Python Pillow - Creating Images With Colors
- Python Pillow - Converting Color String to RGB Color Values
- Python Pillow - Converting Color String to Grayscale Values
- Python Pillow - Change the Color by Changing the Pixel Values
- Image Manipulation
- Python Pillow - Reducing Noise
- Python Pillow - Changing Image Modes
- Python Pillow - Compositing Images
- Python Pillow - Working with Alpha Channels
- Python Pillow - Applying Perspective Transforms
- Image Filtering
- Python Pillow - Adding Filters to an Image
- Python Pillow - Convolution Filters
- Python Pillow - Blur an Image
- Python Pillow - Edge Detection
- Python Pillow - Embossing Images
- Python Pillow - Enhancing Edges
- Python Pillow - Unsharp Mask Filter
- Image Enhancement and Correction
- Python Pillow - Enhancing Contrast
- Python Pillow - Enhancing Sharpness
- Python Pillow - Enhancing Color
- Python Pillow - Correcting Color Balance
- Python Pillow - Removing Noise
- Image Analysis
- Python Pillow - Extracting Image Metadata
- Python Pillow - Identifying Colors
- Advanced Topics
- Python Pillow - Creating Animated GIFs
- Python Pillow - Batch Processing Images
- Python Pillow - Converting Image File Formats
- Python Pillow - Adding Padding to an Image
- Python Pillow - Color Inversion
- Python Pillow - M L with Numpy
- Python Pillow with Tkinter BitmapImage and PhotoImage objects
- Image Module
- Python Pillow - Image Blending
- Python Pillow Useful Resources
- Python Pillow - Quick Guide
- Python Pillow - Function Reference
- Python Pillow - Useful Resources
- Python Pillow - Discussion
Python Pillow - Creating a Watermark
What is Watermark?
A watermark is a recognizable and often transparent image or text that is superimposed onto another image, document or object to indicate ownership, authorship or origin. Watermarks are typically used to protect intellectual property and content which prevent unauthorized use or distribution and provide attribution. They serve various purposes as mentioned below −
Copyright Protection − Artists, photographers and content creators often use watermarks to protect their intellectual property by marking their work with their name, logo or copyright information. This helps deter unauthorized use or distribution of their content.
Branding − Companies and organizations use watermarks to brand their images or documents with their logos, names or slogans. This reinforces their brand identity and makes it clear where the content originated.
Document Verification − Watermarks can be used on official documents such as certificates to prevent forgery or unauthorized reproduction. For example diplomas or notarized documents may have watermarks.
Security − In currency and other security documents intricate and often invisible watermarks are used to deter counterfeiting. These watermarks are difficult to reproduce accurately making it easier to detect counterfeit bills or documents.
Image Attribution − In the context of stock photography and image licensing watermarks can be used to display a preview of the image with a watermark. When a user purchases the image they receive a version without the watermark.
Digital Media − In the digital world watermarks are often used on images and videos shared online to protect content. They can also be used to give credit to the original creator.
Watermarks can take various forms such as text, logos, patterns or even invisible data embedded within the content. They are typically placed in a manner that is difficult to remove without compromising the quality of the content and their purpose is to provide a visual or digital indicator of authenticity or ownership.
Creating the text watermark
Now let's explore how to create a text watermark by using the pillow library. In pillow there is no direct method to create the watermarks but we can achieve it by using the ImageDraw, ImageFont and Image methods.
Following is the input image used in all the examples of this chapter.

Example
In this example we are creating the text Tutorialspoint as the watermark by using the pillow library.
from PIL import Image, ImageDraw, ImageFont original_image = Image.open("Images/butterfly.jpg") draw = ImageDraw.Draw(original_image) watermark_text = "Tutorialspoint" font_size = 20 font = ImageFont.truetype("arial.ttf", font_size) text_color = (255, 255, 255) #White color (RGB) text_width, text_height = draw.textsize(watermark_text, font) image_width, image_height = original_image.size margin = 10 #Margin from the right and bottom edges position = (image_width - text_width - margin, image_height - text_height - margin) draw.text(position, watermark_text, font=font, fill=text_color) original_image.save("output Image/watermarked_image.png") original_image.show()
Output

Creating the image Watermark
Previously we created the text watermark on an image, in the same way we can create an image as the watermark by using the ImageDraw, copy and paste methods available in pillow.
Example
In this example we are creating the Tutoriaslpoint logo image as the watermark by the methods available in pillow.
from PIL import Image original_image = Image.open("Images/butterfly.jpg") watermark = Image.open("Images/tutorialspoint.png") #Use the appropriate image file for your watermark #Resize the watermark image to a specific width or height target_width = 200 #Adjust this to our preferred size aspect_ratio = float(target_width) / watermark.width target_height = int(watermark.height * aspect_ratio) watermark = watermark.resize((target_width, target_height), Image.ANTIALIAS) watermarked_image = original_image.copy() #Adjust the position where you want to place the watermark (e.g., bottom right corner) position = (original_image.width - watermark.width, original_image.height - watermark.height) watermarked_image.paste(watermark, position, watermark) watermarked_image.save("output Image/watermarked_image.jpg") watermarked_image.show()
Output
