Exemple #1
0
        public static void Run()
        {
            //ExStart:AdjustBrightness
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();

            // Load an image in an instance of Image
            using (Image image__1 = Image.Load(dataDir + Convert.ToString("aspose-logo.jpg")))
            {
                // Cast object of Image to RasterImage
                RasterImage rasterImage = (RasterImage)image__1;

                // Check if RasterImage is cached and Cache RasterImage for better performance
                if (!rasterImage.IsCached)
                {
                    rasterImage.CacheData();
                }

                // Adjust the brightness
                rasterImage.AdjustBrightness(70);

                // Create an instance of TiffOptions for the resultant image, Set various properties for the object of TiffOptions and Save the resultant image
                TiffOptions tiffOptions = new TiffOptions(TiffExpectedFormat.Default);
                tiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
                tiffOptions.Photometric   = TiffPhotometrics.Rgb;
                rasterImage.Save(dataDir + Convert.ToString("AdjustBrightness_out.tiff"), tiffOptions);
            }
            //ExEnd:TiffOptionsConfiguration
        }
        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:AdjustBrightness
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();

            // Load an image in an instance of Image
            using (Image image__1 = Image.Load(dataDir + Convert.ToString("aspose-logo.jpg")))
            {
                // Cast object of Image to RasterImage
                RasterImage rasterImage = (RasterImage)image__1;

                // Check if RasterImage is cached
                if (!rasterImage.IsCached)
                {
                    // Cache RasterImage for better performance
                    rasterImage.CacheData();
                }

                // Adjust the brightness
                rasterImage.AdjustBrightness(70);

                // Create an instance of TiffOptions for the resultant image
                TiffOptions tiffOptions = new TiffOptions(TiffExpectedFormat.Default);
                // Set various properties for the object of TiffOptions
                tiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
                tiffOptions.Photometric   = TiffPhotometrics.Rgb;

                // Save the resultant image to TIFF format
                rasterImage.Save(dataDir + Convert.ToString("AdjustBrightness_out.tiff"), tiffOptions);
            }
            // ExEnd:TiffOptionsConfiguration
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:AdjustingBrightness

            String sourceFile = dataDir + @"sample.psd";
            string destName   = dataDir + @"AdjustBrightness_out.tiff";

            // Load an existing image into an instance of RasterImage class
            using (var image = Image.Load(sourceFile))
            {
                // Cast object of Image to RasterImage
                RasterImage rasterImage = (RasterImage)image;

                // Check if RasterImage is cached and Cache RasterImage for better performance
                if (!rasterImage.IsCached)
                {
                    rasterImage.CacheData();
                }

                // Adjust the brightness
                rasterImage.AdjustBrightness(-50);

                // Create an instance of TiffOptions for the resultant image, Set various properties for the object of TiffOptions and Save the resultant image
                TiffOptions tiffOptions = new TiffOptions(TiffExpectedFormat.Default);
                tiffOptions.BitsPerSample = new ushort[] { 8, 8, 8 };
                tiffOptions.Photometric   = TiffPhotometrics.Rgb;

                rasterImage.Save(destName, tiffOptions);
            }

            //ExEnd:AdjustingBrightness
        }