ASP代码
If CheckRegExp(LCase(FileName),"jpg|gif|bmp|png") Then
Dim Jpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Jpeg.Open BlogPath & "/" & ZC_UPLOAD_DIRECTORY & "/" & FileName ' 图片所在位置
Dim aa
aa=Jpeg.Binary '将原始数据赋给aa
'=========加文字水印=================
Jpeg.Canvas.Font.Color = &Hfffffff '水印文字颜色
Jpeg.Canvas.Font.Family = "Arial" '字体
Jpeg.Canvas.Font.Bold = true '是否加粗
Jpeg.Canvas.Font.Size = 16 '字体大小
Jpeg.Canvas.Font.ShadowColor = &H000000 '阴影色彩
Jpeg.Canvas.Font.ShadowYOffset = 1
Jpeg.Canvas.Font.ShadowXOffset = 1
Jpeg.Canvas.Brush.Solid = True
Jpeg.Canvas.Font.Quality = 4 '输出质量
Jpeg.Canvas.Print Jpeg.OriginalWidth-120,Jpeg.OriginalHeight-30,"郑州网建 WWW.CAMNPR.COM" '水印位置及文字
bb=Jpeg.Binary '将文字水印处理后的值赋给bb,这时,文字水印没有不透明度
'============调整文字透明度================
dim MyJpeg
Dim Logo
dim bb
Set MyJpeg = Server.CreateObject("Persits.Jpeg")
MyJpeg.OpenBinary aa
Set Logo = Server.CreateObject("Persits.Jpeg")
Logo.OpenBinary bb
MyJpeg.DrawImage 0,0, Logo, 0.4 '0.4是透明度
MyJpeg.Save BlogPath & "/" & ZC_UPLOAD_DIRECTORY & "/" & FileName ' 保存文件
set aa=nothing
set bb=nothing
Jpeg.close
MyJpeg.Close
Logo.Close
END IF
4、完成了,是不是很简单,赶快去试试吧!