【python案例】运用PIL在图片加上数字水印的方法
很多时候我们需要在图像上面加上水印,在php上面写这个问题要花大段的代码,但是python只需要几行代码。
首先看看我们的原图。

#!/usr/bin/python
# -*- coding: utf-8 -*-
from PIL import Image, ImageFont, ImageDraw,ImageFilter
# 打开图片
image = Image.open('in.jpg')
# 获取图片宽和高
w, h = image.size
# 选择加文字的字体
font = ImageFont.truetype('arial.ttf', 50)
# 写图片
draw = ImageDraw.Draw(image)
# 设置写图片的位置和颜色字体
draw.text((w-30, 0), '5', fill=(255, 10, 10), font=font)
# 输出图片
image.save('out.jpg', 'jpeg')
运行这段python代码。
看看我们输出的图像。

【python案例】将mysql数据库内容分割为小CSV文件 【python案例】批量生成可逆转的优惠券
Your article helped me a lot, is there any more related content? Thanks!
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
295c249c31020860e6fbf965ff84e0be这种代码 如何实现的
32位的md5代码。