這裡成功的關鍵在於:水印圖片一定要是png格式的,且在去掉背景的情況下效果也一樣。操作實作函數:
複製代碼代碼如下:
Function AddWater(n)
Set Photo = Server.CreateObject(Persits.Jpeg)
PhotoPath = Server.MapPath(n)
Photo.Open PhotoPath
Photo.Interpolation=1
Photo.Quality=100
iWidth=Photo.OriginalWidth
iHeight=Photo.OriginalHeight
iiwidth=214 '水印圖片的寬度
iiheight=51 '浮水印圖片的高度
Photo.Canvas.DrawPNG iWidth-iiWidth-5, iHeight-iiHeight-5,Server.MapPath(Water.png) 'Water.png即為浮水印圖片
Photo.save Server.mappath(n) '輸出圖片
Set Photo = Nothing
End Function
調用方法:
<% Call AddWater(圖片名稱)%>