When I save a jpg file using bitmap.save, it saves as jpeg 4-1-1 when I specify the encoder and quality, but as 4-2-2 when I don't. I would like to save it as 4-2-2 with a higher quality than the default. Is that possible using bitmap.save? Do I lose anything by saving with 4-1-1?
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