1 <%
2 ' This code will show you how to CROP image.
3   
4 Dim oGraphic
5 Set oGraphic = Server.CreateObject("PhotoSprite.Graphic")
6   
7   ' Original image name
8   oGraphic.SourceFile = Server.MapPath( "images/demo.jpg" )
9   
10   ' Destination image name, and can make the same as the original image name
11   oGraphic.DestFile   = Server.MapPath( "images/tmp/crop.jpg" )
12   
13   
14   ' Crop shape
15   '   Rect, Square, Ellipse, Circle
16   
17   ' Rectangle
18   '   X and Y are the rectangle's top left apex coordinate
19   '   Width and Height are the rectangle's width and height
20     oGraphic.CropShape  = "Rectangle"
21     oGraphic.X  = 70
22     oGraphic.Y  = 25
23     oGraphic.Width   = 260
24     oGraphic.Height  = 240
25   
26   ' Square
27   '   X and Y are the square's top left apex coordinate
28   '   Width is square's edge length
29   '   Height is invalid
30   ' oGraphic.CropShape  = "Square"
31   ' oGraphic.X = 70
32   ' oGraphic.Y  = 30
33   ' oGraphic.Width = 240
34   
35   ' Ellipse
36   '   X and Y are the ellipse's center coordinate
37   '   Width  is the ellipse's major axis
38   '   Height is the ellipse's minor axis
39   ' oGraphic.CropShape  = "Ellipse"
40   ' oGraphic.X  = 70
41   ' oGraphic.Y  = 30
42   ' oGraphic.Width  = 260
43   ' oGraphic.Height = 240
44   
45   ' Circle
46   '   X and Y are the circle's center coordinate
47   '   Width  is the circle's radius
48   '   Height is invalid
49   ' oGraphic.CropShape  = "Circle"
50   ' oGraphic.X  = 70
51   ' oGraphic.Y  = 30
52   ' oGraphic.Width  = 250
53   
54   
55   ' Croping image by appointed shape
56   oGraphic.Crop
57   
58 Set oGraphic = Nothing
59 %>
60   
61 <%
62 ' Show the contrastive effect
63 Response.Write "<img src=""images/demo.jpg"" border=""0"">"
64 Response.Write "<img src=""images/tmp/crop.jpg"" border=""0"">"
65 %>
66