How to despeckle to remove point noise from an image in Java

Often the most subtle of filters have the best effect on a photo. This is certainly true of noise reduction, which can have a pleasantly smoothing effect on an image without the detail loss of a blur. That being said, writing a script for this effect is quite an undertaking. What would you say if we could shave off about 99% of the work required? We can accomplish this easily using an API, as you shall see.

The first step for us is to install our library using Jitpack. To do this, we must simply add these two references to pom.xml via the following code snippets:

Repository snippet


Dependency snippet


Now we can invoke filterDespeckle and give it an imageFile, as you see demonstrated here:

// Import classes://import com.cloudmersive.client.invoker.ApiClient;//import com.cloudmersive.client.invoker.ApiException;//import com.cloudmersive.client.invoker.Configuration;//import com.cloudmersive.client.invoker.auth.*;//import com.cloudmersive.client.FilterApi;ApiClient defaultClient = Configuration.getDefaultApiClient();// Configure API key authorization: ApikeyApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");Apikey.setApiKey("YOUR API KEY");// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.setApiKeyPrefix("Token");FilterApi apiInstance = new FilterApi();File imageFile = new File("/path/to/file"); // File | Image file to perform the operation on.  Common file formats such as PNG, JPEG are supported.try {byte[] result = apiInstance.filterDespeckle(imageFile);System.out.println(result);} catch (ApiException e) {System.err.println("Exception when calling FilterApi#filterDespeckle");e.printStackTrace();}

And it’s as simple as that. How about we try it out on a photo?

Image for post

Now here is the result after despeckling:

Image for post

Subtle, but undeniably improved.

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store