如何使用TiffBitmapEncoder保存TIFF CCITT G4单条? [英] How to save TIFF CCITT G4 single strip using TiffBitmapEncoder ?
问题描述
有人知道我可以如何强制TiffBitmapEncoder在单个条带中编写TIFF CCITT Group4吗?
下面的代码运行良好(即它正在生成单个条带TIFF),直到我在Windows 7下运行它为止.似乎Windows 7中发生了一些变化,导致我的代码生成了以多个条带编码的TIFF CCITT G4文件.
Does anybody know how I can force the TiffBitmapEncoder to write TIFF CCITT Group4 in a single strip?
The following code was working fine (i.e. it was producing single strip tiff's) until I ran it under Windows 7. It seems something has changed in Windows 7 causing my code to produce TIFF CCITT G4 files encoded with multiple strips.
TiffBitmapDecoder decoder = new TiffBitmapDecoder(source, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource bitmapSource = decoder.Frames[0];
FileStream target = new FileStream(@"d:\temp\test.tiff", FileMode.Create);
TiffBitmapEncoder encoder = new TiffBitmapEncoder();
encoder.Compression = TiffCompressOption.Ccitt4;
encoder.Frames.Add(BitmapFrame.Create(bitmapSource));
encoder.Save(target);
target.Close();
推荐答案
在Windows 7 WIC中,您无法强制编码器进行编码单条TIFF.
In Windows 7 WIC, you are unable to force the encoder to encode single strip TIFFs.
可能的解决方法是:
http://stackoverflow.com/questions/1287065/windows -7-保存为tiff-ccitt-group4更改
此外,您可以尝试以下解决方法:
In addition, you can try the workaround at:
这篇关于如何使用TiffBitmapEncoder保存TIFF CCITT G4单条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!