public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_PSD(); //ExStart:ApplyMedianAndWienerFilters string sourceFile = dataDir + @"sample.psd"; string destName = dataDir + @"median_test_denoise_out.gif"; // Load the noisy image using (Image image = Image.Load(sourceFile)) { // Cast the image into RasterImage RasterImage rasterImage = image as RasterImage; if (rasterImage == null) { return; } // Create an instance of MedianFilterOptions class and set the size, Apply MedianFilterOptions filter to RasterImage object and Save the resultant image MedianFilterOptions options = new MedianFilterOptions(4); rasterImage.Filter(image.Bounds, options); image.Save(destName, new GifOptions()); } //ExEnd:ApplyMedianAndWienerFilters }
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:ApplyMedianAndWienerFilters // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); // Load the noisy image using (Image image = Image.Load(dataDir + "asposelogo.gif")) { // caste the image into RasterImage RasterImage rasterImage = image as RasterImage; if (rasterImage == null) { return; } // Create an instance of MedianFilterOptions class and set the size. MedianFilterOptions options = new MedianFilterOptions(4); // Apply MedianFilterOptions filter to RasterImage object. rasterImage.Filter(image.Bounds, options); // Save the resultant image image.Save(dataDir + "median_test_denoise_out.gif"); } }
public static void Run() { //ExStart:ApplyMedianAndWienerFilters // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); // Load the noisy image using (Image image = Image.Load(dataDir + "asposelogo.gif")) { // Caste the image into RasterImage RasterImage rasterImage = image as RasterImage; if (rasterImage == null) { return; } // Create an instance of MedianFilterOptions class and set the size, Apply MedianFilterOptions filter to RasterImage object and Save the resultant image MedianFilterOptions options = new MedianFilterOptions(4); rasterImage.Filter(image.Bounds, options); image.Save(dataDir + "median_test_denoise_out.gif"); } }
public static void Run() { // ExStart:ApplyMedianAndWienerFilters // The path to the documents directory. string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); // Load the noisy image using (Image image = Image.Load(dataDir + "asposelogo.gif")) { // Caste the image into RasterImage RasterImage rasterImage = image as RasterImage; if (rasterImage == null) { return; } // Create an instance of MedianFilterOptions class and set the size, Apply MedianFilterOptions filter to RasterImage object and Save the resultant image MedianFilterOptions options = new MedianFilterOptions(4); rasterImage.Filter(image.Bounds, options); image.Save(dataDir + "median_test_denoise_out.gif"); } }
public static void Run() { Console.WriteLine("Running example OptimizationStrategyInFilters"); string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages(); string fileName = "SampleTiff1.tiff"; string output = "SampleTiff1.out.tiff"; string inputFileName = Path.Combine(dataDir, fileName); Console.WriteLine("Memory optimization in Filters started.."); using (RasterImage rasterImage = (RasterImage)Image.Load( inputFileName, new LoadOptions { BufferSizeHint = 50 })) { FilterOptionsBase filterOptions = new MedianFilterOptions(6 /*size*/); rasterImage.Filter(rasterImage.Bounds, filterOptions); rasterImage.Save(Path.Combine(dataDir, output)); } Console.WriteLine("Finished example OptimizationStrategyInFilters"); }