破JPEG文件這是推動我瘋了,所以....NET生產在IE和FF
當調整圖像以小縮圖,產生的圖像無法通過IE和FF可以完全顯示。 Opera正確顯示圖像,並且還可以顯示Windows圖像。
這是一段代碼做調整大小:
final_image = New System.Drawing.Bitmap(92, 110)
graphic = System.Drawing.Graphics.FromImage(final_image)
graphic.FillRectangle(New System.Drawing.SolidBrush(System.Drawing.Color.White), New System.Drawing.Rectangle(0, 0, 92, 110))
graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic
graphic.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality
graphic.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality
graphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality
graphic.DrawImage(original_image, 0, 0, 92, 110)
Dim info() As Drawing.Imaging.ImageCodecInfo = Drawing.Imaging.ImageCodecInfo.GetImageEncoders()
Dim encoderParameters As Drawing.Imaging.EncoderParameters
encoderParameters = New Drawing.Imaging.EncoderParameters(1)
encoderParameters.Param(0) = New Drawing.Imaging.EncoderParameter(Drawing.Imaging.Encoder.Quality, 100L)
其結果是:
如果你的瀏覽器在上面正確地表示圖像(從FF3屏幕捕獲):
Screen capture from FF3 http://incito.hr/Clipboard02.png
不過,如果我增加縮略圖尺寸126x150 - 一切都很好,在所有瀏覽器:
因此,它總是將它修剪成方形圖像? – 2009-06-30 06:18:37
幾乎 - 顯示的圖像是92x94px – Vnuk 2009-06-30 06:20:59
我的猜測是丟失的EOF是相機或任何拍攝照片的錯誤。我查看了我在圖形應用程序中編寫的代碼,這基本上是你在做什麼,所以我不認爲這是你的錯。 – colithium 2009-06-30 06:32:53