public void MonoDithering_Bayer4x4_CanSaveAsMonohromaticTiff() { // given string tiffFile = string.Format("{0}.tif", GetCurrentMethod()); MonoDithering converter = new Bayer4x4MonoDithering(); // when using (var bmpDithered = converter.Dither(testColorBitmap)) converter.SaveAsMonoTiff(bmpDithered, tiffFile); // then using (var bmpDithered = new Bitmap(tiffFile)) Assert.IsTrue(bmpDithered.PixelFormat == PixelFormat.Format1bppIndexed); }
//[Ignore] public void MonoDithering_Input32bppRgbBitmapIsWorking() { // given MonoDithering converter = new Bayer4x4MonoDithering(); string tiffFile = string.Format("{0}.tif", GetCurrentMethod()); using (var inputBitmap = new Bitmap(testColorBitmap.Width, testColorBitmap.Height, PixelFormat.Format32bppRgb)) { using (var g = Graphics.FromImage(inputBitmap)) { g.DrawImage(testColorBitmap, new Rectangle(0, 0, testColorBitmap.Width, testColorBitmap.Height)); } // when using (var bmpDithered = converter.Dither(inputBitmap)) { converter.SaveAsMonoTiff(bmpDithered, tiffFile); // then Assert.AreEqual(bmpDithered.PixelFormat, PixelFormat.Format8bppIndexed); } } }