vb net save bitmap to tiff CCITT4

时间:2015-12-02 08:27:18

标签: vb.net bitmap tiff

我已经使用了问题中的代码

What would be a good TRUE black and white colormatrix?

并且工作正常..但是当我尝试使用CCITT4压缩保存在TIFF中时,出现错误,参数值无效...如果我使用LZW压缩,它工作正常..我使用代码:

Dim myImageCodecInfo As ImageCodecInfo
myImageCodecInfo = GetEncoderInfo(ImageFormat.Tiff)

Dim myEncoderParameters As New EncoderParameters(1)
Dim myEncoderParameter As New EncoderParameter(System.Drawing.Imaging.Encoder.Compression, EncoderValue.CompressionCCITT4)
myEncoderParameters.Param(0) = myEncoderParameter

bmp.Save(path & "\test.tif", myImageCodecInfo, myEncoderParameters)
有人可以帮帮我吗?感谢..

1 个答案:

答案 0 :(得分:0)

项目解决了问题:

http://www.codeproject.com/Articles/15186/Bitonal-TIFF-Image-Converter-for-NET

bmp必须转换为双色调1bpp索引,否则CCITT4压缩格式的bmp.save函数会导致错误。