我正在使用下面的代码来减小图像的大小。它工作正常。我的问题是,一张 3MB 的图片会缩小到 470~ KB。有没有办法进一步减小文件大小?我使用了所有可能的插值模式、平滑模式和其他设置,但生成的图像仍然在 400 kb 左右。这些图像用于报纸网站,因此也应保持其品质。
编辑我的图像尺寸是 4000 x 3000 像素,我正在缩小到 650 像素宽。
Dim image_p As Image = _
ResizeImage(img, Convert.ToInt32(pWidth), Convert.ToInt32(pHeight))
Private Function ResizeImage( _
original_img As Bitmap, width As Integer, height As Integer) As Bitmap
Dim callback As New Image.GetThumbnailImageAbort(AddressOf GetThumbAbort)
Dim new_img As New Bitmap(original_img, width, height) 'new blank bitmap'
Dim g As Graphics = Graphics.FromImage(new_img)
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
g.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighSpeed
g.CompositingQuality = _
System.Drawing.Drawing2D.CompositingQuality.HighSpeed
g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver
g.DrawImage(original_img, 0, 0, width, height)
Return new_img
End Function