2
当我使用bitmap.save保存jpg文件时,当我指定编码器和质量时,它保存为JPEG 4-1-1,但是当我不指定编码器和质量时,保存为4-2-2。我想把它保存为4-2-2,质量比默认值高。这可能使用bitmap.save?用4-1-1保存我会失去什么吗?如何在.net中以4-2-2和高质量保存jpeg?
Dim bmp As Bitmap
Dim ep As New EncoderParameters(1)
Dim sysCodecs() As ImageCodecInfo
Dim jpgCodec, cdc As ImageCodecInfo
sysCodecs = ImageCodecInfo.GetImageEncoders()
' get jpg codec
jpgCodec = Nothing
For Each cdc In sysCodecs
If String.Compare(cdc.MimeType, "image/jpeg", True) = 0 Then
jpgCodec = cdc
Exit For
End If
Next cdc
If jpgCodec IsNot Nothing Then
ep.Param(0) = New EncoderParameter(Encoder.Quality, 97)
bmp = Bitmap.FromFile(filename)
bmp.Save(outname, jpgCodec, ep) ' saves 4-1-1
bmp.Save(outname) ' saves 4-2-2
end if
谢谢 - 看起来像是leadtools或imagemagick。 – xpda 2010-10-18 03:09:40