以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  关于压缩图片问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=139573)

--  作者:km007
--  发布时间:2019/8/16 0:01:00
--  关于压缩图片问题

Dim file As String = "d:\\test.jpg"
Dim img As image = getImage(file)
Dim bmp As bitmap
If img.width > 600 Then
    If 600 * (img.height / img.width) > 338 Then
        bmp = new bitmap(img, 600*(338/(600*(img.height/img.width))), 338)
    Else
        bmp = new bitmap(img, 600, 600 * (img.height / img.width))
    End If
End If
bmp.save("d:\\缩略图.jpg")
bmp.Dispose

 

执行该语句后,原图 大小是 325 KB,生成的缩略图却变成 617 KB,请问这个要怎么让缩略图大小变小?

 

原图


图片点击可在新窗口打开查看此主题相关图片如下:timg (1).jpg
图片点击可在新窗口打开查看

 

缩略图

图片点击可在新窗口打开查看此主题相关图片如下:testjpg
图片点击可在新窗口打开查看

[此贴子已经被作者于2019/8/16 0:02:38编辑过]

--  作者:有点蓝
--  发布时间:2019/8/16 8:59:00
--  
Dim file As String = "e:\\test.jpg"
Dim img As image = getImage(file)
Dim bmp As bitmap
If img.width > 600 Then
    If 600 * (img.height / img.width) > 338 Then
        bmp = new bitmap(img, 600*(338/(600*(img.height/img.width))), 338)
    Else
        bmp = new bitmap(img, 600, 600 * (img.height / img.width))
    End If
    bmp.save("e:\\缩略图.jpg",img.RawFormat)
    bmp.Dispose
End If