DEV Community

Dmitry Matuzko
Dmitry Matuzko

Posted on

4 1

Introduction to Aspose.Imaging, Part 4.

Part 1

Part 2

Part 3

In this article I will describe one of the most important features of Aspose.Imaging, filtering images, and what filters are availible.

Filtering images

Applying a filter to image is very simple, just create a descendant of FilterOptionsBase and pass it to RasterImage's Filter method:

// Load the image
using (Image image = Image.Load(dataDir + "asposelogo.gif"))
{
    // Convert the image into RasterImage, Pass Bounds[rectangle] 
    // of image and GaussianBlurFilterOptions instance to Filter method and Save the results
    RasterImage rasterImage = (RasterImage)image;
    rasterImage.Filter(rasterImage.Bounds, new GaussianBlurFilterOptions(5, 5));
    rasterImage.Save(dataDir + "BlurAnImage_out.gif");
}
Enter fullscreen mode Exit fullscreen mode

So you can perform filtering of only a part of image if you need to.

Filter types

There are several supported filters. First, there are MedianFilterOptions which specify median filter, BigRectangularFilterOptions and SmallRectangularFilterOptions - different kinds of box filter, BilateralSmoothingFilterOptions, which, namely, does bilateral smoothing, two kinds of convolutional filters - GaussianBlurFilterOptions and SharpenFilterOptions, again with descriptive names, and the most interesting ones are deconvolutional filters that perform Wiener deconvolution - GaussWienerFilterOptions, that removes Gaussian blur, and MotionWienerFilterOptions, that removes motion blur.
BigRectangularFilterOptions and SmallRectangularFilterOptions are parameterless.
MedianFilterOptions requires filter box size to create.
BilateralSmoothingFilterOptions can be created without parameters or with kernel size as parameter.
GaussianBlurFilterOptions can be created without parameters with default values, or you can provide filter radius and sigma.
Same applies to SharpenFilterOptions.
GaussWienerFilterOptions also can be created default, or with filter radius and sigma - if you know the parameters with which the blur was applied.
MotionWienerFilterOptions is created with length, angle, that are defining the blur vector and smoothing factor of the blur, so you can tune optimum parameters for removing motion blur from image.

That's all for now, stay tuned!

For more examples please visit the Aspose.Imaging GitHub page. There's also Twitter and Facebook pages for news on Aspose.Imaging.

Image of Wix Studio

2025: Your year to build apps that sell

Dive into hands-on resources and actionable strategies designed to help you build and sell apps on the Wix App Market.

Get started

Top comments (0)

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay