rpa_image_watermarkText
给图片添加文字水印
1. 函数
rpa_image_watermarkText(text, x, y, fontInfo)
- text:字符串类型,水印文本;
- x, y:整型,水印文本坐标;
- fontInfo:RpaFontInfo类型,字体信息,定义如下:
class RpaFontInfo:
def __init__(self):
self.color = "#ffff0000"
self.fontFamily = "微软雅黑"
self.fontSize = 12
self.bold = False
self.italic = False
self.underline = False
self.strikeOut = False
2. 返回值
若执行成功返回True,执行失败返回False,通过rpa_getLastErrorCode()获取错误码,rpa_getLastErrorMsg()获取错误信息。
3. 示例
# 开始打水印
ret = rpa_image_watermarkStart("d:/image_resize.png", "d:/dst.png")
# 添加文字水印
fontInfo = RpaFontInfo()
fontInfo.color = "#ffff0000"
fontInfo.fontFamily = "微软雅黑"
fontInfo.fontSize = 15
fontInfo.bold = True
fontInfo.italic = True
fontInfo.underline = True
fontInfo.strikeOut = True
ret = rpa_image_watermarkText("中文水印", 30, 100, fontInfo)
# 添加图片水印
ret = rpa_image_watermarkLogo("d:/hnu.png", 0, 0)
# 结束打水印
ret = rpa_image_watermarkEnd()