The input parameter is the image path to be processed. You can adjust the parameter as needed or add other parameters.
Text watermark instance code
- Function WordWatermark (ImagePath)
- Dim Image
- Set Image = Server. CreateObject ("Persits. Jpeg") create an object
- Image. Open server. mappath (ImagePath) Image Location
- Image. Canvas. Font. Color = & H000000 Color, which is set to: Black
- Image. Canvas. Font. Family = "" set the Font
- Whether to set Image. Canvas. Font. Bold = False to Bold
- Image. Canvas. Font. Size = 26 Font Size
- Image. Canvas. Font. Quality = 4 text definition
- Image. Canvas. Print Image. OriginalWidth/2-170, Image. OriginalHeight-30, "watermark text" watermark text
- Image. Save server. mappath (ImagePath) Save the file
- Set Image = Nothing
- End Function
- Image Watermark
- Function ImageWatermark (ImagePath)
- Set Image = Server. CreateObject ("Persits. Jpeg ")
- Determine the image path to add a watermark
- PhotoPath = Server. MapPath (ImagePath)
- Image. Open PhotoPath
- Enable watermark image
- Set Logo = Server. CreateObject ("Persits. Jpeg ")
- LogoPath = Server. MapPath ("logo.jpg") watermark image
- Logo. Open LogoPath
- Logo. Width = 121 watermark image size
- Logo. Height = 50
- Transition_Color = & h0066cc
- Place the watermark in the uploaded Image
- Image. DrawImage Image. width-150, Image. height-59, Logo, 1, Transition_Color, 90
- Here, you can change the watermark position (photo. width-210, photo. height-40 here I am in the bottom right corner of the image) and the watermark transparency.
- Save the added watermark image
- Image. Save Server. MapPath (ImagePath)
- Set Photo = Nothing
- End Function