Code for adding watermarks to ASP Images

Source: Internet
Author: User

CopyCode The Code is as follows: 'text watermark
Function wordwatermark (ImagePath)
Dim image
Set image = server. Createobject ("persits. jpeg") 'creates 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 ")
'Are you sure you want to add the watermark image path?
Photopath = server. mappath (ImagePath)
Image. Open photopath
'Open the 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's position (photo. Width-210, photo. Height-40 here I put it in the bottom right corner of the image) and the watermark's transparency.
'Save the image after adding the watermark
Image. Save server. mappath (ImagePath)

Set photo = nothing
End Function

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.