Answer the question
In order to leave comments, you need to log in
How to display a watermark for example black?
How can I make a water snack not white but black here is the source code
from PIL import Image, ImageDraw, ImageFont
import sys
try:
tatras = Image.open("test.jpg")
except:
print("Unable to load image")
sys.exit(1)
idraw = ImageDraw.Draw(tatras)
text = 'Привет'
font = ImageFont.truetype("arial.ttf", size=30)
idraw.text((10, 10), text, font=font)
tatras.save('tatras_watermarked.png')
Answer the question
In order to leave comments, you need to log in
idraw.text((10, 10), text, font=font, fill=(0,0,0,255))
fill
is a tuple of four numbers, the color is encoded according to the RGBA scheme (that is, transparency can be adjusted).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question