I am trying to convert bmp to tiff using the code from another thread .NET TIFF file: RGB to CMYK conversion possible without a third party library?:
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();
I generated the original test bmp image from c#:
But my final tiff image is:
I use windows paint to see the pixal color, and the color for upper blue should be R:0 G:0 B: 255 A: 0 but it is R:24 G:74 B:124 in the tiff.
What might be wrong?