改成
語法:
Dim sTmp As String
With CommonDialog2
.FileName = ""
.Filter = "JPEG files (*.jpg) |*.jpg|BMP files (*.bmp) |*.bmp"
.ShowSave
If .FileName = "" Then Exit Sub
sTmp = LCase(Right(.FileName,3)) '得到最右邊的副檔名並統一轉成小寫
If sTmp = "bmp" Then
SavePicture Picture1.Image, .FileName
ElseIf sTmp = "jpg" Then
SaveJPG Picture1.Image, .FileName, 100 '品質從1~100
'SaveJPG 參考 http://forum.slime.com.tw/thread250858.html#post2179045
'**圖像改解析度**
Dim byteData(17) As Byte
Open .FileName For Binary Access Read As #1
Get #1, , byteData()
Close #1
'將影像解析度改成 300 dpi = 十六進制 01 2C
byteData(14) = &H01
byteData(15) = &H2C
byteData(16) = &H01
byteData(17) = &H2C
Open .FileName For Binary Access Write As #1
Put #1, , byteData()
Close #1
'**************
EndIf
End With