private static void SaveBlackWhiteTIFFwithRLE(Document doc, string dataDir, bool highSensitivity)
{
// Select the TIFF format with 100 dpi.
ImageSaveOptions imgOpttiff = new ImageSaveOptions(SaveFormat.Tiff);
imgOpttiff.Resolution = 100;
// Set RLE compression.
imgOpttiff.TiffCompression = TiffCompression.Rle;
// Aply grayscale filter.
imgOpttiff.ImageColorMode = ImageColorMode.Grayscale;
// Set brightness and contrast according to sensitivity.
if (highSensitivity)
{
imgOpttiff.ImageBrightness = 0.4f;
imgOpttiff.ImageContrast = 0.3f;
}
else
{
imgOpttiff.ImageBrightness = 0.9f;
imgOpttiff.ImageContrast = 0.9f;
}
// Save multipage TIFF grayscale with low bright and contrast
doc.Save(string.Format("{0}{1}", dataDir, "result Rle.tiff"), imgOpttiff);
Console.WriteLine("\nDocument converted to TIFF successfully with black and white and Rle compression.\nFile saved at " + dataDir + "Result Rle.tiff");
}
}