我正在尝试使用另一个线程.NET TIFF file: RGB to CMYK conversion possible without a third party library?中的代码将bmp转换为tiff:
Stream imageStream = new FileStream(filename2, FileMode.Open, FileAccess.Read, FileShare.Read);
BitmapFrame myBitmapSource = BitmapFrame.Create(imageStream);
FormatConvertedBitmap newFormatedBitmapSource = new FormatConvertedBitmap();
newFormatedBitmapSource.BeginInit();
newFormatedBitmapSource.Source = myBitmapSource;
newFormatedBitmapSource.DestinationFormat = System.Windows.Media.PixelFormats.Cmyk32;
newFormatedBitmapSource.EndInit();
TiffBitmapEncoder encoder = new TiffBitmapEncoder();
encoder.Compression = TiffCompressOption.None;
encoder.Frames.Add(BitmapFrame.Create(newFormatedBitmapSource));
Stream cmykStream = new FileStream(filename2+".tif", FileMode.Create, FileAccess.Write, FileShare.Write);
encoder.Save(cmykStream);
cmykStream.Close();
我从c#生成了原始测试bmp图像:
但我最后的tiff图片是:
我使用windows paint来查看pixal颜色,上面蓝色的颜色应该是R:0 G:0 B:255 A:0但它是R:24 G:74 B:124中的tiff。< / p>
可能出现什么问题?