Beispiel #1
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:CompressingTiff

            // Load a PSD file as an image and cast it into PsdImage
            using (PsdImage psdImage = (PsdImage)Image.Load(dataDir + "layers.psd"))
            {
                // Create an instance of TiffOptions for the resultant image
                TiffOptions outputSettings = new TiffOptions(TiffExpectedFormat.Default);

                // Set BitsPerSample, Compression, Photometric mode and graycale palette
                outputSettings.BitsPerSample = new ushort[] { 4 };
                outputSettings.Compression   = TiffCompressions.Lzw;
                outputSettings.Photometric   = TiffPhotometrics.Palette;
                outputSettings.Palette       = ColorPaletteHelper.Create4BitGrayscale(true);

                psdImage.Save(dataDir + "SampleTiff_out.tiff", outputSettings);
            }


            //ExEnd:CompressingTiff
        }
        public static void Run()
        {
            Console.WriteLine("Running example CompressingTIFFImagesWithLZWAlgorithm");
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();

            // Load an image through file path location or stream
            Image image = Image.Load(dataDir + "SampleTiff.tiff");

            // Create an instance of TiffOptions for the resultant image
            TiffOptions outputSettings = new TiffOptions(TiffExpectedFormat.Default);

            // Set BitsPerSample, Compression, Photometric mode and graycale palette
            outputSettings.BitsPerSample = new ushort[] { 4 };
            outputSettings.Compression   = TiffCompressions.Lzw;
            outputSettings.Photometric   = TiffPhotometrics.Palette;
            outputSettings.Palette       = ColorPaletteHelper.Create4BitGrayscale(false);
            image.Save(dataDir + "SampleTiff_out.tiff", outputSettings);
            Console.WriteLine("Finished example CompressingTIFFImagesWithLZWAlgorithm");
        }
        public static void Run()
        {
            // To get proper output please apply a valid Aspose.Imaging License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx.");
            //ExStart:CompressingTIFFImagesWithAdobeDeflateCompression
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();

            // Load an image through file path location or stream
            Image image = Image.Load(dataDir + "SampleTiff1.tiff");

            // Create an instance of TiffOptions for the resultant image
            TiffOptions outputSettings = new TiffOptions(TiffExpectedFormat.Default);

            // Set BitsPerSample, Photometric mode & Compression mode
            outputSettings.BitsPerSample = new ushort[] { 4 };
            outputSettings.Compression   = TiffCompressions.AdobeDeflate;
            outputSettings.Photometric   = TiffPhotometrics.Palette;

            // Set graycale palette
            outputSettings.Palette = ColorPaletteHelper.Create4BitGrayscale(false);
            //ExEnd:CompressingTIFFImagesWithAdobeDeflateCompression
        }