<%@ Page Language=vb Debug=True %>
<%@ import namespace=systemdrawing %>
<%@ import namespace=systemdrawingimaging %>
<%@ import namespace=systemdrawingdrawingd %>
<%
dim strFilename as string
dim i as SystemDrawingImage
strFilename = servermappath(/chrisfsckjpg)
i = SystemDrawingImageFromFile(strFilename)
dim b as New systemdrawingbitmap(iwidth iheight pixelformatformatbpprgb)
dim g as graphics = graphicsfromimage(b)
gclear(colorblue)
旋转图片
iRotateFlip(SystemDrawingRotateFlipTypeRotateFlipX)
gdrawimage(iNew point())
iRotateFlip(SystemDrawingRotateFlipTypeRotateFlipY)
gRotateTransform()
gdrawimage(iNew point())
gRotateTransform()
gdrawimage(iNew point())
gRotateTransform()
gdrawimage(iNew point())
gRotateTransform()
gdrawimage(iNew point())
gRotateTransform()
gRotateTransform()
gdrawimage(iNew rectangle()New rectangle(iwidthiheight)GraphicsUnitPixel)
gRotateTransform()
拉伸图片
gdrawimage(iNew rectangle()New rectangle(iwidthiheight)GraphicsUnitPixel)
gdrawimage(iNew rectangle()New rectangle(iwidthiheight)GraphicsUnitPixel)
gdrawimage(iNew rectangle()New rectangle(iwidthiheight)GraphicsUnitPixel)
切割图片
gdrawimage(iNew rectangle()GraphicsUnitPixel)
gdrawimage(iNew rectangle()GraphicsUnitPixel)
旋转图片
iRotateFlip(SystemDrawingRotateFlipTypeRotateFlipX)
gdrawimage(iNew rectangle()GraphicsUnitPixel)
responsecontenttype=image/jpeg
bsave(responseoutputstream imageformatjpeg)
bdispose()
%>
在以上的程序中我们看到实现图象处理的各种技巧仔细观察我们可以知道旋转图片其实是用了一个RotateFlip方法而切割和拉伸图片完全是通过设置DrawImage的不同参数来实现
四总结
ASPNET的图象处理可以实现的功能很多我们在这里其实只是简单的介绍更多功能的应用需要我们在实践中摸索总结
[] [] [] []