AspJpeg picture or text with a watermark, generate thumbnail code instances

Source: Internet
Author: User

'

function Name: Watermarkfont
' Function: Add text watermark to picture
' Parameter: Imgurl original address
' FontColor text color
' FontFamily text font
' FontSize text font size
' FontBold text Bold
' Fontposx text positioning x
' Fontposy text positioning y
' Font text content
' Newimgurl new picture output address intersection
'****************************************************
Sub Watermarkfont (Imgurl,fontcolor,fontfamily,fontsize,fontbold,fontposx,fontposy,font,newimgurl)
Dim jpeg ' '//Declaration variable
Set jpeg = Server.CreateObject (defaultjpeg) '//Calling Component
Jpeg.open Server.MapPath (Imgurl) '//Source picture location
Jpeg.canvas.font.color = "&h" &fontcolor '//Watermark font Color
jpeg.canvas.font.family = fontfamily '//Watermark Font
Jpeg.canvas.font.size = FontSize '//Watermark font Size
Jpeg.canvas.font.bold = FontBold '//Bold, Bold: True
Jpeg.canvas.print fontposx, Fontposy, font '//watermark text, two digit 10 for watermark XY coordinates
Jpeg.save Server.MapPath (Newimgurl) '//Create new image with watermark and save location
Set jpeg = Nothing ' '//Logoff component, releasing resources
End Sub

'****************************************************
'

function Name: watermarkpic
' Function: Add image watermark to Picture
' Parameter: Imgurl original address
' Logourl logo original address
' Logowidth logo scaling width
' LOGOPOSX logo relative to the original image of the X location
' Logoposy logo relative to the original image of Y positioning
' Newimgurl the output address of the new picture
'****************************************************
Sub Watermarkpic (Imgurl,logourl,logowidth,logoposx,logoposy,newimgurl)
Dim Photo,logo
Set photo = Server.CreateObject (defaultjpeg)
Set logo = Server.CreateObject (defaultjpeg)
Photo.open Server.MapPath (Imgurl)
Logo.open Server.MapPath (Logourl)
Logo.width = Logowidth
Logo.height = Logo.width * logo.originalheight/logo.originalwidth
Photo.drawimage Logoposx, Logoposy, logo, 0.5, &h000000 ' logo image X,y,logo, transparency, remove color
Photo.save Server.MapPath (Newimgurl)
End Sub

'****************************************************

function Name: Thumbnailimg
' function: Make thumbnails of pictures
' parameters: Imgurl original address
' imgwidth the width of the new map ' imgheight the height of the new map br> ' Newimgurl the location of the new map
' ****************************************************
Sub Thumbnailimg (Imgurl, Imgwidth,imgheight,newimgurl)
Dim jpeg '//declaration variable
If InStr (Imgurl, ":") =0 then Imgurl = Server.MapPath (Imgurl)
If InStr (Newimgurl, ":") =0 then Newimgurl = Server.MapPath (newimgurl)
Set jpeg = Server.CreateObject (DEFAULTJ PEG) '//Call component
Jpeg.open Imgurl '//original position
if imgwidth<> "" and imgheight= "" Then ImgHeight = Imgwidth*j Peg.originalheight/jpeg.originalwidth
If Imgheight<> "" and Imgwidth= "" Then ImgWidth = Imgheight*jpeg.origi Nalwidth/jpeg.originalheight
Jpeg.width = ImgWidth '//Set picture width
Jpeg.height = ImgHeight '//Set picture height
JP Eg.sharpen 1, 130 '//Set sharpening effect
Jpeg.save newimgurl '//Generate thumbnail location and name
Set jpeg = Nothing '//Logoff component, releasing resource
E nd Sub

' aspjpeg 1.4 download
http://down.111cn.net/down/soft/object/2009/0227/38.html
' aspjpeg v1.9.0.1 picture component Download
http ://down.111cn.net/down/soft/object/2009/0523/3311.html

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.