The main idea of adding watermark with PIL library in Python is this:
(1) First create new empty image RGBA with the same size as original image but with transparent background (…, …, …, 0), e.g. a totally transparent black image (255,255,255,0).
(2) Next draw on this new image text with different transparency (e.g. 180 out of 255) and in different place.
(3) Finally use Image.alpha_composite(original_image, text_image) to put text on image with expected transparency.
1. Put a watermark text in the center of an image
from PIL import Image, ImageDraw, ImageFont |
2. Put multiple watermark texts in the center of an image
from PIL import Image, ImageDraw, ImageFont |
3. Put a rotated watermark text in the center of an image
from PIL import Image, ImageDraw, ImageFont |
4. Put multiple rotated watermark text in the center of an image
from PIL import Image, ImageDraw, ImageFont |