<%@ 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的圖象處理可以實現的功能很多我們在這裡其實只是簡單的介紹更多功能的應用需要我們在實踐中摸索總結
[] [] [] []
From:http://tw.wingwit.com/Article/program/net/201311/14866.html