Discussion:
[求助]使用程式產生的縮圖很模糊
(时间太久无法回复)
tony
2006-09-12 08:20:08 UTC
Permalink
œÐ°Ý,­nŠpŠóŒg€~¯àšÏÁY¹ÏÅܱo²MŽ·.ÁÂÁÂ!

<%@ WebHandler Language="VB" Class="GetImage" %>
Imports System.Drawing
Imports System.Drawing.Imaging

Public Class GetImage : Implements IHttpHandler

Public Sub ProcessRequest(ByVal context As HttpContext) Implements
IHttpHandler.ProcessRequest
Dim StrImageId As String = context.Request.QueryString("pic")
Dim StrPath As String = context.Server.MapPath("Image/PicPro/")
Dim ImgWid As Integer
Dim ImgHig As Integer
Dim Image As System.Drawing.Image = Nothing
Dim Percent As Double
Dim TargetWid As Integer = context.Request.QueryString("wid")
Dim TargetHig As Integer
'Dim Image As System.Web.UI.WebControls.Image
If File.Exists(StrPath & StrImageId & ".jpg") Then
Image = Bitmap.FromFile(StrPath & StrImageId & ".jpg")
ImgWid = Image.Width
ImgHig = Image.Height
Percent = TargetWid / ImgWid
TargetHig = Int(ImgHig * Percent)
Image = Image.GetThumbnailImage(TargetWid, TargetHig, Nothing,
IntPtr.Zero)
Image.Save(context.Response.OutputStream, ImageFormat.Jpeg)

End If

context.Response.Flush()
End Sub

Public ReadOnly Property IsReusable() As Boolean Implements
IHttpHandler.IsReusable
Get
Return False
End Get
End Property

End Class
璉璉
2006-09-12 08:54:21 UTC
Permalink
Šs JPEG ®É¡AœÐºû«ù«~œèŠb 75% ¥H€W¡C

€U­±ºô§}Š³«~œè 25%, 50%, 75% €TºØœdšÒ¡C
http://msdn2.microsoft.com/zh-tw/library/system.drawing.imaging.encoder.quality.aspx
©ó news:uv2lNRk1GHA.3656%40TK2MSFTNGP04.phx.gbl µoªí
œÐ°Ý,­nŠpŠóŒg€~¯àšÏÁY¹ÏÅܱo²MŽ·.ÁÂÁÂ!
Imports System.Drawing
Imports System.Drawing.Imaging
Public Class GetImage : Implements IHttpHandler
Public Sub ProcessRequest(ByVal context As HttpContext) Implements
IHttpHandler.ProcessRequest
Dim StrImageId As String = context.Request.QueryString("pic")
Dim StrPath As String = context.Server.MapPath("Image/PicPro/")
Dim ImgWid As Integer
Dim ImgHig As Integer
Dim Image As System.Drawing.Image = Nothing
Dim Percent As Double
Dim TargetWid As Integer = context.Request.QueryString("wid")
Dim TargetHig As Integer
'Dim Image As System.Web.UI.WebControls.Image
If File.Exists(StrPath & StrImageId & ".jpg") Then
Image = Bitmap.FromFile(StrPath & StrImageId & ".jpg")
ImgWid = Image.Width
ImgHig = Image.Height
Percent = TargetWid / ImgWid
TargetHig = Int(ImgHig * Percent)
Image = Image.GetThumbnailImage(TargetWid, TargetHig, Nothing,
IntPtr.Zero)
Image.Save(context.Response.OutputStream, ImageFormat.Jpeg)
End If
context.Response.Flush()
End Sub
Public ReadOnly Property IsReusable() As Boolean Implements
IHttpHandler.IsReusable
Get
Return False
End Get
End Property
End Class
--
­·¬ê¬ì§ÞÅçÃÒŠ³­­€œ¥q ASP.NET Web News Reader 0.2.3 UTF-8 Beta
ºô¯žŠa¹Ï http://tlcheng.twbbs.org/wwwmap.htm
¬y°ìšŸ¬x/°Ï°ì€ôžê·œ/®}ª@ºô/ªŽºÀ¹Ï/»y­µ³q°T €å³¹»Pµ{Š¡
Basic/Fortran/Windows API/.Net/»²§U»¡©úÀÉ ­ì©lœX¡B€å³¹»P°Qœ×
·L³nµ{Š¡³]­p·s°Qœ×°Ï MSDN §Þ³Nœ×ŸÂ¡Aºô€ÍŠ^ÂЫá§Y®É²°T¡B¹q€l¶l¥ó³qªŸ¡G
http://forums.microsoft.com/msdn-cht/default.aspx?siteid=14
--
ASPNET News Reader http://tlcheng.twbbs.org/News/Reader.aspx
RSS 2.0 http://tlcheng.twbbs.org/News/rss2.aspx?Action=List&Newsgroup=microsoft.public.tw.dotnet.framework.aspnet
继续阅读narkive:
Loading...