Aspose.Words.Examples.CSharp.Rendering_and_Printing.ImageColorFilters.SaveGrayscaleTIFFwithLZW C# (CSharp) Method

SaveGrayscaleTIFFwithLZW() private static method

private static SaveGrayscaleTIFFwithLZW ( Document doc, string dataDir, float brightness, float contrast ) : void
doc Document
dataDir string
brightness float
contrast float
return void
        private static void SaveGrayscaleTIFFwithLZW(Document doc, string dataDir, float brightness, float contrast)
        {
            // Select the TIFF format with 100 dpi.
            ImageSaveOptions imgOpttiff = new ImageSaveOptions(SaveFormat.Tiff);
            imgOpttiff.Resolution = 100;

            // Select LZW compression.
            imgOpttiff.TiffCompression = TiffCompression.Lzw;

            // Apply grayscale filter.
            imgOpttiff.ImageColorMode = ImageColorMode.Grayscale;

            // Set brightness and contrast.
            imgOpttiff.ImageBrightness = brightness;
            imgOpttiff.ImageContrast = contrast;

            // Save multipage grayscale TIFF.
            doc.Save(string.Format("{0}{1}", dataDir, "Result Grayscale.tiff"), imgOpttiff);

            Console.WriteLine("\nDocument converted to TIFF successfully with Gray scale.\nFile saved at " + dataDir + "Result Grayscale.tiff");
        }