Function ASP_IMAGE(ByVal durl As String, ByVal surl As String, ByVal w As Integer, ByVal h As Integer)
'ASP.NET 縮圖功能
Dim image As System.Drawing.Image
'Dim anewimage As System.Drawing.Bitmap
Dim callb As System.Drawing.Image.GetThumbnailImageAbort
Dim width, height, newwidth, newheight As Integer
image = System.Drawing.Image.FromFile(durl)
width = image.Width
height = image.Height
If Not (width < w And height < h) Then
If width > height Then
h = w * height / width
Else
w = h * width / height
End If
End If
Dim img As System.Drawing.Bitmap = New System.Drawing.Bitmap(w, h)
Dim graphic As Graphics = Graphics.FromImage(img)
graphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality
graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality
graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
graphic.DrawImage(image, 0, 0, w, h)
image.Dispose()
img.Save(surl, System.Drawing.Imaging.ImageFormat.Jpeg)
img.Dispose()
graphic.Dispose()
End Function
分享 ASP,ASP.NET,VB,C#,程式開發,網站設計,部落格,微網誌,網路行銷,facebook 行銷,噗浪行銷,社群行銷,電腦硬體軟體,網路賺錢等資訊內容。『噗落格』裡的文章大多是從各網站摘錄(轉貼)下來的,僅提供研究及筆記之用途,如有侵權請留言告知!一開始不打算賺錢,一個不可能中的可能
2010年6月20日 星期日
ASP VB.NET 縮圖語法(圖片處理)
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言