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

Apply Median and Wiener Filters

Using Aspose.Imaging for Java 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";

// Create an instance of Image class and load noisy image.
com.aspose.imaging.Image image = com.aspose.imaging.Image.load(inputFilePath);

// caste the image into RasterImage
com.aspose.imaging.RasterImage rasterImage = (com.aspose.imaging.RasterImage) image;

if (rasterImage == null)
{
    return;
}

// Create an instance of MedianFilterOptions class and set the size.
com.aspose.imaging.imagefilters.filteroptions.MedianFilterOptions options = new com.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
com.aspose.imaging.Image image = com.aspose.imaging.Image.load(inputFilePath);

// caste the image into RasterImage
com.aspose.imaging.RasterImage rasterImage = (com.aspose.imaging.RasterImage) image;

if (rasterImage == null)
{
   return;
}

// Create an instance of GaussWienerFilterOptions class and set the radius size and smooth value.
com.aspose.imaging.imagefilters.filteroptions.GaussWienerFilterOptions options = new com.aspose.imaging.imagefilters.filteroptions.GaussWienerFilterOptions(12, 3);
options.setGrayscale(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
com.aspose.imaging.Image image = com.aspose.imaging.Image.load(inputFilePath);

// caste the image into RasterImage
com.aspose.imaging.RasterImage rasterImage = (com.aspose.imaging.RasterImage) image;

if (rasterImage == null)
{
    return;
}

// Create an instance of MotionWienerFilterOptions class and set the length, smooth value and angle.
com.aspose.imaging.imagefilters.filteroptions.MotionWienerFilterOptions options = new com.aspose.imaging.imagefilters.filteroptions.MotionWienerFilterOptions(50, 9, 90);
options.setGrayscale(true);

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

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

Detect Flattened PSD

Using Aspose.Imaging for Java 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 Image class and load PSD file as image.
com.aspose.imaging.Image objImage = com.aspose.imaging.Image.load(flattenPath);

// Cast image object to PSD image
com.aspose.imaging.fileformats.psd.PsdImage psdImage = (com.aspose.imaging.fileformats.psd.PsdImage)objImage;

// do processing

// Get the true value if PSD is flatten and false in case the PSD is not flatten.
System.out.println(psdImage.isFlatten()); 

Enhancements

The following enhancements have been introduced in this release.

  • Process of creating BMP image with RLE8 compression 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 Java 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 Changes section to know what has been changed in the public API since your current version.

Aspose.Imaging for Java 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.