Thumbnail watermark Component wsImage2.0

Source: Internet
Author: User
Tags add end relative version
Thumbnail feature features:
1, the introduction of a variety of picture formats, the current support bmp,jpg,gif and so on.
2, output JPG format thumbnails, custom output compression parameters
3, efficient production of thumbnails, 4 kinds of export methods, convenient and flexible.
4, the picture cuts the function, the custom cuts the area.
5, can buy to get picture size.
6, the support text watermark, can customize the font, color, rotation angle and so on.
7, support picture watermark, picture water lead to support transparency.
8, the performance is more stable, consumes the system resources to be few.

Sample code (for example, in ASP)
• Get picture size information
<%
Set Obj=server. CreateObject ("Wsimage.resize")
Obj. Loadsoucepic Server.MapPath ("25.jpg")
Obj. Getsourceinfo Iwidth,iheight
Response.Write "Picture width:" & iwidth & "<br>"
Response.Write "Picture height:" & iheight & "<br>"
Strerror=obj.errorinfo
If strerror<> "" Then
Response.Write Obj.errorinfo
End If
Obj.free
Set obj=nothing
%>

• Generate thumbnails
<%
Set Obj=server. CreateObject ("Wsimage.resize")
Obj. Loadsoucepic Server.MapPath ("25.jpg")
Obj. Quality=75
Obj. Outputspic Server.MapPath ("25_s.jpg"), 0.5,0.5,3
Strerror=obj.errorinfo
If strerror<> "" Then
Response.Write Obj.errorinfo
End If
Obj.free
Set obj=nothing
%>

Original 25.jpg width: 400 High: 298 Size: 77K

Resulting thumbnail 25_s.jpg width: 200 High: 149 Size: 6K
Description
There are four ways to export a thumbnail:
(1).
Obj. Outputspic Server.MapPath ("25_s.jpg"), 200,150,0
200 for the output width, 150 for the output is high, this type of output is forced output width high, may cause picture distortion.
(2).
Obj. Outputspic Server.MapPath ("25_s.jpg"), 200,0,1
With 200 as the output width, the output height will scale with the column.
(3).
Obj. Outputspic Server.MapPath ("25_s.jpg"), 0,200,2
Output is high with 200, and the output width will scale with the column.
(4).
Obj. Outputspic Server.MapPath ("25_s.jpg"), 0.5,0.5,3
The first 0.5 indicates that the resulting thumbnail is half the width of the original image, which means a narrowing ratio.
The second 0.5 means that the resulting thumbnail is half the height of the original image, which means a high narrowing ratio.
A wide-height narrowing of the proportions means that the original image will be scaled down. If the zoom ratio is greater than 1, the original image is magnified.
From the above four ways to produce thumbnails, you can see that the last parameter is the first of several output forms.

• Cut Pictures
<%
Set Obj=server. CreateObject ("Wsimage.resize")
Obj. Loadsoucepic Server.MapPath ("25.jpg")
Obj. Quality=75
Obj.cropimage Server.MapPath ("25_crop.jpg"), 100,10,200,200
Strerror=obj.errorinfo
If strerror<> "" Then
Response.Write Obj.errorinfo
End If
Obj.free
Set obj=nothing
%>

Original cropsource.jpg width: 400 High: 298 Size: 77K

The resulting cut figure 25_crop.jpg width: 200 High: 200 Size: 7K
Description
In the Cropimage method, parameter 100 indicates the distance from the beginning of the cut to the left of the original image, and 10 indicates the distance from the beginning of the cut to the top edge of the original image, and the latter two parameters indicate the width and height of the cut.

• Add text watermark
<%
Set Obj=server. CreateObject ("Wsimage.resize")
Obj. Loadsoucepic Server.MapPath ("25.jpg")
Obj. Quality=75
Obj. Txtmarkfont = "Chinese Cloud"
Obj. Txtmarkbond = False
Obj. Markrotate = 25
Obj. Txtmarkheight = 25
Obj. Addtxtmark Server.MapPath ("txtmark.jpg"), "Surf Studio", &h00ff00&, 10, 70
Strerror=obj.errorinfo
If strerror<> "" Then
Response.Write Obj.errorinfo
End If
Obj.free
Set obj=nothing
%>

Generated text watermark map txtmark.jpg size: 7K
Description
Loadsoucepic Load Source diagram
Obj. Txtmarkfont Set Watermark Text font
Obj. Txtmarkbond to set the thickness of the watermark text
Obj. Markrotate = 25 rotation angle of the water guide text
Obj. Txtmarkheight = 25 height of the water primer writing
Obj. In the Addtxtmark method, the parameter &H00FF00& is the color code for the watermark text, &h represents hexadecimal, and 10,70 is the coordinate position of the output text relative to the upper-left corner of the picture.

• Add a picture watermark
<%
Set Obj=server. CreateObject ("Wsimage.resize")
Obj. Loadsoucepic Server.MapPath ("25.jpg")
Obj. Loadimgmarkpic Server.MapPath ("Blend.bmp")
Obj. Quality=75
Obj. Addimgmark Server.MapPath ("imgmark.jpg"), 315, 220,&AMP;HFFFFFF, 70
Strerror=obj.errorinfo
If strerror<> "" Then
Response.Write Obj.errorinfo
End If
Obj.free
Set obj=nothing
%>

The resulting picture watermark imgmark.jpg size: 7K
Description
Obj. Loadsoucepic Load Source diagram
Obj. Loadimgmarkpic Load watermark Picture
Obj. Addimgmark 315, 220 for the watermark picture in the source diagram coordinates position (relative to the upper left corner), parameter 70 is opacity.

• Access to copyright information
<%
Set Obj=server. CreateObject ("Wsimage.resize")
Response.Write obj. CopyRight
Obj.free
Set obj=nothing
%>

How to use:
Download the DLL to the local, use the regsvr32 DLL path, register, if your machine is loaded with a low version of this component, please first, and then register the latest version.

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.