使用以下代码,把TIF文件保存到BMP文件时出现失真,如何解决?谢谢!
- Public Function Save(ByRef pszName As String, ByRef iFormat As Integer, ByRef iBitsPerPixel As Integer, ByRef iQuality As Integer, ByRef iModify As Integer) As Integer
- Dim wModify As CodecsSavePageMode
-
- Try
- If iQuality = 1 Then
- iQuality = 2
- End If
-
- Dim Codecs As New RasterCodecs
- Select Case iModify
- Case SaveModifyConstants.SAVE_OVERWRITE
- wModify = CodecsSavePageMode.Overwrite
- Case SaveModifyConstants.SAVE_APPEND
- wModify = CodecsSavePageMode.Append
- Case SaveModifyConstants.SAVE_REPLACE
- wModify = CodecsSavePageMode.Replace
- Case SaveModifyConstants.SAVE_INSERT
- wModify = CodecsSavePageMode.Insert
- End Select
-
- Codecs.Options.Jpeg.Save.QualityFactor = iQuality
- Codecs.Options.Jpeg.Save.CmpQualityFactorPredefined = iQuality
-
- If mBaseImage Is Nothing Then
- mBaseImage = RasterImage.Create(emptyFil_width, emptyFil_height, iBitsPerPixel, 0, Leadtools.RasterColor.FromArgb(emptyFil_backcolor.ToArgb))
- End If
- Codecs.Save(mBaseImage, pszName, iFormat, iBitsPerPixel, 1, 1, 1, wModify)
- Save = 0
- Catch ex As Exception
- Save = 20000
- If mEnableMethodErrors Then
- Throw ex
- End If
- End Try
- End Function
复制代码
|
|