Ikram ul Haq March 23, 2016one Comment

Detect Flattened PSD And Apply Median & Wiener Filters With Aspose.Imaging for .Net 3.4.0

Detect Flattened PSD And Apply Median & Wiener Filters With Aspose.Imaging for .Net 3.4.0

March 23, 2016
Share on FacebookTweet about this on TwitterShare on LinkedIn

We are pleased to announce the release of Aspose.Imaging for .NET 3.4.0. This release allows you to detect flattened PSD. Support to apply median & wiener filters have also been incorporated in this release.

Detect Flattened PSD

Using Aspose.Imaging for .NET API, developers can detect flattened PSD. Following is the code demonstrating the use of IsFlatten property of the PsdImage class.


string flattenPath = "flatten.psd";

// create an instance of PsdImage class and load the PSD file.
using (Aspose.Imaging.FileFormats.Psd.PsdImage image = (Aspose.Imaging.FileFormats.Psd.PsdImage)Image.Load(flattenPath))
{
     // do processing

    // Get the true value if PSD is flatten and false in case the PSD is not flatten.
    Console.WriteLine(image.IsFlatten);
}

Apply Median and Wiener Filters

Using Aspose.Imaging for .NET API, developers can apply median & wiener filters on an image. Following is the code to apply median & wiener filters.

Apply Median Filter


string inputFilePath = @"median_test_noise.gif";
string outputFilePath = @"median_test_denoise.gif";

// Load the noisy image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
{
        // caste the image into RasterImage
        Aspose.Imaging.RasterImage rasterImage = image as Aspose.Imaging.RasterImage;

        if (rasterImage == null)
        {
            return;
        }

       // Create an instance of MedianFilterOptions class and set the size.
       Aspose.Imaging.ImageFilters.FilterOptions.MedianFilterOptions options = new Aspose.Imaging.ImageFilters.FilterOptions.MedianFilterOptions(4);

       // apply MedianFilterOptions filter to RasterImage object.
       rasterImage.Filter(image.Bounds, options);

       // Save the resultant image
       image.Save(outputFilePath);
}

Apply Gauss Wiener Filter


string inputFilePath = @"gauss_test_image.gif";
string outputFilePath = @"gauss_test_result.gif";

// Load the image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
{
     // caste the image into RasterImage
     Aspose.Imaging.RasterImage rasterImage = image as Aspose.Imaging.RasterImage;
     if (rasterImage == null)
     {
         return;
     }

     // Create an instance of GaussWienerFilterOptions class and set the radius size and smooth value.
     Aspose.Imaging.ImageFilters.FilterOptions.GaussWienerFilterOptions options = new Aspose.Imaging.ImageFilters.FilterOptions.GaussWienerFilterOptions(12, 3);
     options.Grayscale = true;

     // apply MedianFilterOptions filter to RasterImage object.
     rasterImage.Filter(image.Bounds, options);

     // Save the resultant image
     image.Save(outputFilePath);
}

Apply Motion Wiener Filter


string inputFilePath = @"gauss_test_image.gif";
string outputFilePath = @"gauss_test_result.gif";

// Load the image
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFilePath))
{
     // caste the image into RasterImage
     Aspose.Imaging.RasterImage rasterImage = image as Aspose.Imaging.RasterImage;
     if (rasterImage == null)
     {
         return;
     }

     // Create an instance of MotionWienerFilterOptions class and set the length, smooth value and angle.
     Aspose.Imaging.ImageFilters.FilterOptions.MotionWienerFilterOptions options = new Aspose.Imaging.ImageFilters.FilterOptions.MotionWienerFilterOptions(50, 9, 90);
     options.Grayscale = true;

     // apply MedianFilterOptions filter to RasterImage object.
     rasterImage.Filter(image.Bounds, options);

     // Save the resultant image
     image.Save(outputFilePath);
}

Enhancements

Following enhancements have been introduced in this release.

  • Process of creating BMP image with RLE8 compression has been improved.

  • Functionality of processing JPEG image with CMYK color mode has been improved.

  • DWG file to PDF conversion process has been improved.

  • JPEG image compression has been upgraded.

Please refer to the release notes of Aspose.Imaging for .NET 3.4.0 for a full view of improvements along with sample code snippets for newly added features. If you are planning to upgrade the API to the latest revision, we strongly suggest you to check the Public API Change section to know what has been changed in the public API since your current version.

Aspose.Imaging for .Net Resources

The resources, you may need to accomplish your tasks:

As always we appreciate your feedback so if you ever have anything to tell us about this release or anything else, please head to the Aspose.Imaging forum for a chat.

Join the Conversation

1 Comment

Leave a comment

Posted inAspose.Imaging Product Family
 

Related Articles