1: // decalres the page output content type
2: Response.ContentType = "image/jpeg"
3:
4: // initialize a new instance of PhotoController
5: Dim objpc As IC.PhotoController.Controller
6: objpc = New IC.PhotoController.Controller
7:
8: // load the image to the controller
9: Dim img As System.Drawing.Image
10:
11: img = System.Drawing.Image.FromFile(Server.MapPath("..") + "\PhotoControllerWebDemoVB\test.jpg”)
12: objpc.LoadImage(img)
13:
14: // create an EmbossFilter
15: Dim filter As EmbossFilter = New EmbossFilter()
16: filter.Level = 3
17: filter.Direction = 120
18:
19: // apply the filter algorithm
20: img = objpc.Filter(filter)
21:
22: // create a bitmap object with the resulted image
23: Dim b As Bitmap
24: b = New Bitmap(img)
25:
26: Dim oStream As New System.IO.MemoryStream
27: Response.ClearContent()
28: b.Save(oStream, System.Drawing.Imaging.ImageFormat.Jpeg)
29:
30: // output the bitmap to the page
31: Response.BinaryWrite(oStream.ToArray())
32:
33: // release all resources
34: objpc.Dispose()
35: b.Dispose()
36: img.Dispose()
37: Response.End()