public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_PSD(); //ExStart:Garysacling String sourceFile = dataDir + @"sample.psd"; string destName = dataDir + @"Grayscaling_out.jpg"; // Load an image in an instance of Image using (Image image = Image.Load(sourceFile)) { // Cast the image to RasterCachedImage and Check if image is cached RasterCachedImage rasterCachedImage = (RasterCachedImage)image; if (!rasterCachedImage.IsCached) { // Cache image if not already cached rasterCachedImage.CacheData(); } // Transform image to its grayscale representation and Save the resultant image rasterCachedImage.Grayscale(); rasterCachedImage.Save(destName, new JpegOptions()); } //ExEnd:Garysacling }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_PSD(); //ExStart:BinarizationWithFixedThreshold String sourceFile = dataDir + @"sample.psd"; string destName = dataDir + @"BinarizationWithFixedThreshold_out.jpg"; // Load an image using (Image image = Image.Load(sourceFile)) { // Cast the image to RasterCachedImage and Check if image is cached RasterCachedImage rasterCachedImage = (RasterCachedImage)image; if (!rasterCachedImage.IsCached) { // Cache image if not already cached rasterCachedImage.CacheData(); } // Binarize image with predefined fixed threshold and Save the resultant image rasterCachedImage.BinarizeFixed(100); rasterCachedImage.Save(destName, new JpegOptions()); } //ExEnd:BinarizationWithFixedThreshold }
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:BinarizationWithFixedThreshold // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); // Load an image in an instance of Image using (Image image = Image.Load(dataDir + "aspose-logo.jpg")) { // Cast the image to RasterCachedImage RasterCachedImage rasterCachedImage = (RasterCachedImage)image; // Check if image is cached if (!rasterCachedImage.IsCached) { // Cache image if not already cached rasterCachedImage.CacheData(); } // Binarize image with predefined fixed threshold rasterCachedImage.BinarizeFixed(100); // Save the resultant image rasterCachedImage.Save(dataDir + "BinarizationWithFixedThreshold_out.jpg"); } // ExEnd:BinarizationWithFixedThreshold }
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:Grayscaling // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); // Load an image in an instance of Image using (Image image = Image.Load(dataDir + "aspose-logo.jpg")) { // Cast the image to RasterCachedImage RasterCachedImage rasterCachedImage = (RasterCachedImage)image; // Check if image is cached if (!rasterCachedImage.IsCached) { // Cache image if not already cached rasterCachedImage.CacheData(); } // Transform image to its grayscale representation rasterCachedImage.Grayscale(); // Save the resultant image rasterCachedImage.Save(dataDir + "Grayscaling_out.jpg"); } // ExEnd:Grayscaling }
public static void Run() { //ExStart:BinarizationWithFixedThreshold // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); // Load an image in an instance of Image using (Image image = Image.Load(dataDir + "aspose-logo.jpg")) { // Cast the image to RasterCachedImage and Check if image is cached RasterCachedImage rasterCachedImage = (RasterCachedImage)image; if (!rasterCachedImage.IsCached) { // Cache image if not already cached rasterCachedImage.CacheData(); } // Binarize image with predefined fixed threshold and Save the resultant image rasterCachedImage.BinarizeFixed(100); rasterCachedImage.Save(dataDir + "BinarizationWithFixedThreshold_out.jpg"); } //ExEnd:BinarizationWithFixedThreshold }
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"; using (var image = (PsdImage)Image.Load(sourceFile)) { RasterCachedImage rasterImage = image; // Set the brightness value. The accepted values of brightness are in the range [-255, 255]. rasterImage.AdjustBrightness(-50); TiffOptions tiffOptions = new TiffOptions(TiffExpectedFormat.Default); rasterImage.Save(destName, tiffOptions); } //ExEnd:AdjustingBrightness }
public static void Run() { Console.WriteLine("Running example BinarizationWithOtsuThreshold"); // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); // Load an image in an instance of Image using (Image image = Image.Load(dataDir + "aspose-logo.jpg")) { // Cast the image to RasterCachedImage and Check if image is cached RasterCachedImage rasterCachedImage = (RasterCachedImage)image; if (!rasterCachedImage.IsCached) { // Cache image if not already cached rasterCachedImage.CacheData(); } // Binarize image with Otsu Thresholding and Save the resultant image rasterCachedImage.BinarizeOtsu(); rasterCachedImage.Save(dataDir + "BinarizationWithOtsuThreshold_out.jpg"); } Console.WriteLine("Finished example BinarizationWithOtsuThreshold"); }